Failing to Post New Relic metrics to Metrics v2 API

I am trying to ingest some metric data to Metric v2 API using the following curl request:
curl -vvv -k -H "Content-Type: application/json" -H "Api-Key: $USER_API_KEY" POST$APP_ID/metrics/data.json --data '<path-to-metric-data-json>/nr_data.json'
This is the content of my json file:
This metric does not exist in the application. (I’m assuming that if a metric does not already exist in the application, a new metric is created through the POST request.)
I’m unable to post this metric to the application successfully.
I receive a “HTTP/1.1 400 Bad Request” status for my metrics POST request.

Is there any documentation that will provide information regarding the format to be followed for data payload for metrics?

1 Like

Hi, @sburse: You may not post metrics to that endpoint. The correct endpoint for posting metrics is Please see Report metrics via the Metric API | New Relic Documentation for more information.

1 Like

Thanks for your clarification. Just wanted to clarify 2 more doubts:
Is the purpose of the REST API limited to querying only?
Also, Telemetry SDKs can be used to communicated with New Relic and post metric data right?

Hi @sburse

The main goal of our REST API is for older API for querying and configuration.

Its important to note that NerdGraph is in the process of replacing this.

REST API still has some configuration abilities that NerdGraph doesn’t yet have, I would highlight that we recommend your first choice to be to use NerdGraph because that will be where we are focusing our attention and adding features.

In relation to your question on Telemetry SKD’s metics, please see the following docs for more insight, Best practices for OpenTelemetry with New Relic | New Relic Documentation and Introduction to OpenTelemetry with New Relic | New Relic Documentation.

Should have any further questions please do reach out, we are here to help!

1 Like

3 posts were split to a new topic: What may cause 429 error with low number of requests?

A post was merged into an existing topic: What may cause 429 error with low number of requests?