Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
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

OpsGenie REST API not returning any results

Hello,

I have been requested to create a Dashboard that displays the status of our Key infrastructure objects. I am trying to utilize the Opsgenie REST API to obtain a list of open alerts within a saved search. However, in Postman, when I try this, I don't get any results in the Body. I'm not sure if I am doing this correctly.

The GET URL I am using is:

https://api.opsgenie.com/v2/alerts?query="status: open"&searchIdentifier="Meraki - network has become unreachable"&searchIdentifierType=id&offset=0&limit=20&sort=createdAt&order=desc

OpsGenieAPI.JPG

 

 

Thank you for any help on this one,
Tom

1 answer

1 vote
Arumugam M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 12, 2023

Hello Tom, 

This is Arumugam from Atlassian support and I'm happy to help!

I understand that you are working with our APIs and not getting the expected results. 

While looking at the query you constructed, it seems that the query is not URI encoded. 

Please follow the steps below to get the results:

1. Go to your Opsgenie instance list view page and construct the search query in UI and search for alerts and see if it is fetching the results that you want. 

2. Once you have the search query, now you can use that from Postman or any programming language. However, you would need to URI encode the search parameter before appending it to the API endpoint. 

Here is a sample CURL request of how it should be for your reference:

curl -XGET -H "Authorization: GenieKey eb243592-faa2-4ba2-a551q-1afdf565c889" 'https://api.opsgenie.com/v2/alerts?query=status%3Aopen&offset=7&limit=10&sort=createdAt&order=desc'

Kindly try the same an let me know how it goes. 

Thanks, 
Arumugam

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events