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

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

Getting started with Opsgenie API

Hi! I'm trying to get familiar with using Opsgenie's APIs (the alert APIs in particular), and I haven't been able to get any results at all.

I've tried using Postman to authorize myself using one the API keys found under "Settings" > "API Key Management", but that just always gets a 401 Unauthorized response.

I've also tried using curl from the command line as shown below:

curl -X GET 'https://api.opsgenie.com/v2/alerts/requests/' -H 'Authorization: xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'

 But I keep getting results like:

curl: (1) Protocol "'https" not supported or disabled in libcurl
curl: (6) Could not resolve host: xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'

When I use "http" instead of "https", I get a similar response.

Do you have any advice for returning some of the alerts used by your Opsgenie instance?

P.S. "eazyBI" is in the tags because I'd eventually want to use eazyBI's REST API feature to pull data from Opsgenie. But for now I'm trying to establish a connection.

1 answer

1 accepted

3 votes
Answer accepted
Nick H Atlassian Team Jan 11, 2021

Hi @Sam ,

You'll want to use the API key from an API integration to complete the Alert API requests.

Under the Standard and Enterprise plans, integrations can be added globally under the Settings tab >> Integration list tab. 

Or under all plans, integrations can be added under a team's Integrations tab - but will only be able to create alerts for the team it's configured under.

https://docs.opsgenie.com/docs/api-integration

API comm 1.jpg

Try adding one of these / testing, and let us know if you run into any other questions or issues!

Thank you @Nick H , I can now connect to the API!

@Sam @Nick H Would you be able to post a picture of how it looks in postman? I have the API key but am still getting a "Could not authenticate" error. Not sure I have it formatted right. 

@Michael Rogers Did you put "GenieKey " before the API key? That worked for me.

image.png

Nick H Atlassian Team Jan 12, 2021

Hi @Michael Rogers ,

Remember the API key (or GenieKey) needed will be from an API integration:

API comm 4.jpg

 

Below are a few examples of our Alert API and Postman. I used our Alert API doc to grab the body in the request below: https://docs.opsgenie.com/docs/alert-api#create-alert

API comm 2.jpg

 

The only mandatory field is the message. For testing, you could use a body as simple as this:

API comm 3.jpg

 

Hope this helps! If you continue seeing a "Could not authenticate" error, let us know. Or feel free to share the syntax as well.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Opsgenie

Leveraging Atlassian’s Opsgenie and AWS Cloudformation Registry to stay ahead of incidents

In the past, managing IT infrastructure was a hard job. It required a lot of manual effort and it was hard to keep track of all the necessary information (monitoring, scalability etc). Thankfully, as...

1,815 views 0 11
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