Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

API Help - Get On-Calls

I'm very new to using API's. I'm trying to integrate our ticketing system : SCSM with Opsgenie.  I'm trying to use the "Who's On Call API"

https://api.opsgenie.com/v2/schedules/:scheduleIdentifier/on-calls

The curl example shows:

curl -X GET 'https://api.opsgenie.com/v2/schedules/ScheduleName/on-calls?scheduleIdentifierType=name&flat=true'
--header 'Authorization: GenieKey eb24alp-faa2-4ba2-a551q-1alpf565c889'

I'm using powershell:

Invoke-webrequest -Method Get -Uri 'https://api.opsgenie.com/v2/schedules/SRE_Test_schedule?scheduleType=name&flat=true' -Header @{"Authorization"="GenieKey XXXXXXXX-XXXXX-XXXX-XXXXXXXXXXXX"}

I'm getting 

The remote server returned an error: (403) Forbidden.

Ideas?

Does anyone have any examples of using API's this way?

 

2 answers

1 accepted

0 votes
Answer accepted

I figured it out.  I had not properly registered the GenieKey for Authorization. 

For any other folks new to API's, this is what I learned:

The data returned is JSON. If you want to parse data out of the contents returned, this is how I did it:

$data = Invoke-Restmethod -Uri https://api.opsgenie.com/v2/teams/172299f2-9567-4e38-bcb7-b1f992932ca1 -Method Get -Headers @{'Authorization'='GenieKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}

# to get the username for example:

$data.data[0].members.user.username

 

I hope this is helpful to anyone that was new to powershell / API's and Opsgenie API integration.

Hi @Scott Wright.

Could you help me with my request? I'm getting the same error when I'm trying to add note to alert.  

You may answer in my post:

https://community.atlassian.com/t5/Opsgenie-questions/Add-Note-to-Alert-via-IPA-403-ERROR/qaq-p/1434998

Regards,
Michael

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Opsgenie

How do I use Zebrium + Opsgenie for Root Cause Analysis (RCA)?

This article was co-authored by Gavin Cohen of Zebrium. Zebrium has a bi-directional integration with Opsgenie and is a machine learning solution for RCA.  We all know the drill. 💤 You'r...

291 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you