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
Thank you for any help on this one,
Tom
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.