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 |
---|---|---|
|
Successful data ingest. |
|
|
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.
|
|
|
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.
|