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

Opsgenie and Postman - Maintenance with API

Derek Stevenson August 8, 2022

Hello all! I'm trying to be able to use Postman to create maintenance windows for our instances. I'm does not very familiar with Postman and am not having any luck. I have tried to follow this but I still get 401 error when trying to run it, any help would be appreciated. I think I just have the wrong genie key or API? 
https://learning.postman.com/docs/integrations/available-integrations/opsgenie/

image.png

2 answers

1 accepted

1 vote
Answer accepted
Nick H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 8, 2022

Hi @Derek Stevenson ,

Listing global maintenance policies should require no more than this request:

main1.jpg

 

The API key being used in my example is from a global API integration - meaning it's not assigned to any team. You should also be able to use an API key from the API key management tab.

If your Opsgenie is an EU instance, then you'll want to use the URL: https://api.eu.opsgenie.com/v1/maintenance

If that's the case, then using the US URL would probably show a 401 error.

Derek Stevenson August 10, 2022

Wow thanks that worked! like I said I'm not that savvy with postman yet, didn't realize we type the key as "Authorization" and add the geniekey xxx in value. Thanks so much!

Like Nick H likes this
0 votes
Eugenio Onofre
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 8, 2022

Hello @Derek Stevenson

You should use Authorization header.
The value would be GenieKey XXXXXXX, where XXXXXXX is your API Key from Opsgenie.

Regards,
Eugenio

Derek Stevenson August 8, 2022

Wait sorry I'm a little confused like this? It doesn't work either i still get the 401 error. I'm using the default Opsgenie API that comes with account, should i make a separate new one for this?

image.png

Eugenio Onofre
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 9, 2022

You should use something like the cURL below:

 

curl --location --request GET 'https://api.opsgenie.com/v1/maintenance' \
--header 'Authorization: GenieKey XXXXX'
Where XXXXX will be your key. 
Ryan Brailey
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 21, 2024

OP is asking about connecting via Postman, not curl. The accepted answer shows the "Headers" populated with both an Authorization and Content-Type key-value pair which should be successful in authenticating and receiving results via Postman. 

Like Eugenio Onofre likes this

Suggest an answer

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

Atlassian Community Events