Admin API key cannot POST

Hey,
I’m doing a hackathon (and the clock is ticking!), and I need to automagically create newrelic Alerts and Dashboards using the REST API.
With the Key I generated in the “Account Settings” I can GET, but when I try to POST I get HTTP403

How do I get a valid API key?

Thanks,

1 Like

Hi, @codercave: Can you provide an example of the JSON payload you are trying to POST?

hi @philweber,

using the API explorer, alerts policies > Create

{
  "policy": {
    "incident_preference": "PER_POLICY",
    "name": "TEST-POLICY"
  }
} 

here’s the response



HTTP/1.1 403 Forbidden
cache-control: no-cache
content-type: application/json

{
  "error": {
    "title": "You do not have privileges to perform this action."
  }
}

if I GET, with the same API key:

HTTP/1.1 200 OK
cache-control: max-age=0, private, must-revalidate
content-type: application/json
etag: "3d0a9a66775eb1746ca0e8271b26727e"
link: <https://api.newrelic.com/v2/alerts_policies.json?page=0>; rel="last"

{
  "policies": []
}
1 Like

Are you sure you are using an Admin API key? It should be one that you generated here:

interestingly, that widget doesn’t even load!
I’m using the “free” newrelic account, and I’m logged in with the “owner” user.
There’s nothing underneath the Your Account ID is… :frowning:

Sorry, I don’t have any more ideas. :slightly_frowning_face:

I guess I found out the reason! Rather disappointing :frowning_face:

2 Likes

Hey @codercave - definitely understand your frustration. Heads up that we should have good news on this front shortly.

If you get the chance, mind sharing a little more about the hackathon and your project?

@rishav.dhar sure: I’ve got some AWS serverless application, and I want to create alerts and dashboards based on the type of resource that is being created.
Let’s say I have some AWS Lambdas, I want to automatically create alerts for error rates above, let’s say, 1% . Or alert on DynamoDB table consumption of read/write capacity.

2 Likes