Docs » Other data ingestion methods » Send metrics, traces, and events using Splunk Observability Cloud REST APIs

Send metrics, traces, and events using Splunk Observability Cloud REST APIs πŸ”—

You can use the REST API to send telemetry directly to Splunk Observability Cloud. See Send data points and Send traces, metrics, and events in the developer documentation.

Start sending data using the API πŸ”—

Start experimenting by sending data using the following curl command:

curl --request POST \
  --header "Content-Type: application/json" \
  --header "X-SF-TOKEN: <ORG_TOKEN>" \
  --data \
  '{
      "gauge": [
          {
              "metric": "memory.free",
              "dimensions": { "host": "server1" },
              "value": 42
          }
      ]
  }' \
  https://ingest.<REALM>.signalfx.com/v2/datapoint

Send custom metrics using the API πŸ”—

To send custom metrics, replace <ORG_TOKEN> with an org token for your organization in the code block provided as an example.

in Splunk Observability Cloud UI, an org token is called an access token. To learn how to obtain an org token, see Create and manage organization access tokens using Splunk Observability Cloud.

When you send a request, use the endpoint specific to your realm. Replace <REALM> with the name of your realm, which you can find on your profile page in the user interface. To learn more, see Realms in endpoints .

Return codes πŸ”—

The REST APIs return the following codes:

API

Return code

Description

Send Traces, Metrics and Events

200

Successful data ingest.

Send Traces, Metrics and Events

400

Bad request.
This can happen if the JSON was not well-formed, if you specified a data point outside of one of the metric type arrays, or if you forgot to specify a metric name for a data point.

Send Traces, Metrics and Events

401

Unauthorized.
The ingest token specified in the X-SF-TOKEN header in the request doesn’t have authorization to send data points to the organization.

This page was last updated on Jul 24, 2023.