Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Planned Maintenance Create with Python


If you are like we are, you have regular maintenance windows for patching, etc at the same time every month.  There is no way to clone scheduled maintenance alert suppression policies in Opsgenie.  You have to create them one-at-a-time every month.  If you have several, it can take a while to enter.  I looked up their maintenance api examples for POST.  They have the example listed in curl format.  I converted the curl to Python, plugged in my api info, changed the description & start/stop dates/times and it worked beautifully.  I just thought I would share something that will make my life a bit easier.  Enjoy!

BTW: Be sure to convert the times to Zulu or UTC.  I had to add 6 hours to my scripted entries to get the times right.

import requests
from requests.structures import CaseInsensitiveDict

url = ""

headers = CaseInsensitiveDict()
headers["Authorization"] = "GenieKey <your API key here>"
headers["Content-Type"] = "application/json"

data = """
"description": "TEST Maintenance Description",
"time": {
"type" : "schedule",
"startDate": "2021-10-31T08:45:00Z",
"endDate": "2021-10-31T21:45:00Z"
"rules": [
"state": "enabled",
"entity": {
"id": "<id of notification policy>",
"type": "policy"

resp =, headers=headers, data=data)





Log in or Sign up to comment
Community showcase
Published in Jira Service Management

Just dropped! New Lightning Talks: Marketplace episodes

  Hi everyone! Want to learn how customizing your Atlassian apps can improve workflows, enhance teamwork, and boost efficiency across your organization? Check out our new, 15-minute Lig...

112 views 0 0
Read article

Atlassian Community Events