The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Opsgenie Maintenance API

Roshna
March 24, 2024

Hi Team,

I am trying to schedule a maintenance for a given notification policy using API but it keeps failing 

List of available notification policies:


curl -X GET 'https://api.opsgenie.com/v2/policies/notification?teamId=e56dce09-300d-476d-abbd-1a68a379df91' --header 'Authorization: GenieKey <removed >


{"data":[{"id":"abdf75c6-8be8-434e-849a-bcd39b2bc251","name":"Sites down simultaneously","type":"notification","order":0,"enabled":true},{"id":"b0809a2d-f661-42d8-8449-5d3607a23e1c","name":"OPS-62832","type":"notification","order":1,"enabled":false}],"took":0.032,"requestId":"673861ab-87c0-45f6-b743-ee4a9975673b"}

 

Creating maintenance policy for "b0809a2d-f661-42d8-8449-5d3607a23e1c"

curl -X POST 'https://api.opsgenie.com/v1/maintenance?teamId=e56dce09-300d-476d-abbd-1a68a379df91' --header 'Authorization: GenieKey <removed>' --header 'Content-Type: application/json' --data '{"description": "OPS-62832", "time": {"type": "schedule", "startDate": "2024-03-22T00:00:00.000+1000", "endDate": "2024-03-22T06:00:00.000+1000"}, "rules": [{"state": "enabled", "entity": {"id": "b0809a2d-f661-42d8-8449-5d3607a23e1c", "type": "policy"}}]}'


{"message":"Policy with given id [b0809a2d-f661-42d8-8449-5d3607a23e1c] can not be found","took":0.05,"requestId":"b7dafb9c-290a-4813-96d2-dce87327de56"}(py3-env)

I'm uncertain whether I'm overlooking something or not approaching this correctly.

Could someone kindly assist me with this issue?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Roshna
March 25, 2024

Issue resolved after setting correct permission for the key.

TAGS
AUG Leaders

Atlassian Community Events