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.
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.
Try adding one of these / testing, and let us know if you run into any other questions or issues!
Hi @Michael Rogers ,
Remember the API key (or GenieKey) needed will be from an API integration:
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
The only mandatory field is the message. For testing, you could use a body as simple as this:
Hope this helps! If you continue seeing a "Could not authenticate" error, let us know. Or feel free to share the syntax as well.