Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

OpsGenie API (Create alert) Authentication problem

Hi, all.

I'm trying to create an alert via OpsGenie API but I'm getting an error related to the authentication.
Please, find below the steps I'm following and all the details about the problem.

 

Here is the command I'm executing:

curl --location --request POST 'https://api.opsgenie.com/v2/alerts' \--header 'Authorization: GenieKey <MY API KEY>' \--header 'Content-Type: text/plain' \--data-raw ''\''{"message": "Test alert", "description": "This is just a test" }'\'''

 But, I'm getting this error:

{ "code": 40301, "message": "To perform this action, use an API key from an API integration.", "took": 0.002, "requestId": "1343b720-98e8-49f1-bb4e-1706c2b9ae83"}

 

I generated the API key from the settings menu (Settings -> API Key Management). The API key has read, create and update access rights.

Regarding the API URL, I tried to use the Europe URL - https://api.eu.opsgenie.com/v2/alerts

But, I get this error

{ "message": "Could not authenticate", "took": 0.007, "requestId": "6d3adc4c-d201-4fdc-9caf-8db62233e4fb"}

 

What am I missing?

 

Thanks in advance.

1 answer

1 accepted

1 vote
Answer accepted
Nick H Atlassian Team Nov 12, 2020

Hi @Ricardo Felgueiras 

The Create Alert API requires an API key from an API integration. This can be added under the Settings tab >> Integrations tab, or under a team's Integrations tab. NOTE - If the integration is assign to a team, it will only be able to create alerts for that team.

An API key from the API Key Management tab will produce this 403 error (apiKey is valid but the apiKey cannot do this operation because of permissions).

Let us know if you have any issues or errors after.

Nick H Atlassian Team Nov 12, 2020

Also - I noticed your syntax is using header:

Content-Type: text/plain

And Opsgenie will be expecting it in

Content-Type: application/json

Otherwise you'll most likely receive a "Content type is not supported" error.

Yes, it works. 

 

Thank you very much for your help.

Like Nick H likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
Community showcase
Published in Opsgenie

New! Investigate and re-deploy stable deployments from the Incident Investigation view in Opsgenie

We’re excited to announce the latest enhancement to Opsgenie’s Incident Investigation view. Now when an incident occurs users can select the previous stable deployment, and begin the redeployment pro...

309 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you