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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,358
Community Members
 
Community Events
185
Community Groups

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

4 votes
Answer accepted
Nick H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
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
Atlassian Team members are employees working across the company in a wide variety of roles.
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.

Like Raja Dorji likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events