Getting 403 when posting data to Metrics API

I am getting 403 while posting to newrelic api endpoint on telemetry data platform even when I am entering the correct key.

Tried examples -

Getting the following exception -

[main] WARN com.newrelic.telemetry.transport.BatchDataSender - Response from New Relic ingest API. Discarding MetricBatch recommended.: code: 403, body: {}
Exception in thread "main" com.newrelic.telemetry.exceptions.DiscardBatchException: The New Relic API failed to process this request and it should not be retried.
	at com.newrelic.telemetry.transport.BatchDataSender.sendPayload(
	at com.newrelic.telemetry.transport.BatchDataSender.send(
	at com.newrelic.telemetry.metrics.MetricBatchSender.sendBatch(
	at com.newrelic.telemetry.examples.GaugeExample.main(

Hi there @akshaya.gawand -

Thanks for reaching out on that issue. Just a heads up that the Java Telemetry SDK is categorized as a Community open source project - its is supported by the community and the project maintainers, but is not officially supported. If no one here has any leads for you, I would definitely recommend reaching out to the maintainers as well!

1 Like

Thanks, my problem is resolved when I used “X-License-Key” instead of “Api-key”
curl -vvv -k -H “Content-Type: application/json” -H “X-License-Key: MY_KEY_HERE” --data “[{ “metrics”:[{ “name”:“memory.heap”, “type”:“gauge”, “value”:2.3, “timestamp”:1617108780000, “attributes”:{“”:“”} }] }]”