Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Set Post-mortem Executive Summary via API

I would like to set the Executive Summary in a Post Mortem via the API. I am using Python. There is an API function for it, but unfortunately there is no curl example. Usually with a curl example I can verify that my syntax and formatting works on the commandline and then transfer to Python.

Does anybody have an example that works?

Here is a snippet of what I am trying to accomplish. The error code that I get when running this is HTTP Error 422: Unprocessable Entity

postmortemid = "0..........8"
initialURL = ""
URL = initialURL + postmortemid + "/executive-summary"
jsondata = {"type":"adf","executivesummary":{"content":[{"type":"heading","attrs":{"level":4},"content":[{"type":"text","text":"Leadup"}]}],"type":"doc","version":1}}
headers = {"Content-Type": "application/json", "Authorization": og_key}
  data = json.dumps(jsondata) 
  bindata = data if type(data) == bytes else data.encode('utf-8')
  req = urllib.request.Request(URL, data=bindata, headers=headers, method='PUT')
  result = urllib.request.urlopen(req)
  if result.getcode() >= 200 and result.getcode() < 300:
    messages =
    json_obj = json.loads(messages)
    print("Non 200 code from OpsGenie", result.getcode())
except Exception as e:



1 answer

1 accepted

1 vote
Answer accepted
Agaci Avinas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Dec 21, 2022

Hi Wolfgang,

I am Agaci from Opsgenie support. Happy to help you today.

Your code looks good but there are two possibilities for the 422 status.

1. The "S" in the executiveSummary key in the payload should be in upper case as per the document

2. 'utf-8' encode is not required as json.dumps itself is going add the escape character to the strings. Adding to that encode the values under executiveSummary inside single quotes.

After the changes your code would like below while constructing and posting the payload,


data = {"type":"adf", "executiveSummary":'{"content":[{"type":"heading","attrs":{"level":4},"content":[{"type":"text","text":"Leadup"}]}],"type":"doc","version":1}}'}

jsondata = json.dumps(data)

req = requests.put(URL, data=jsondata, headers=headers)



Thank you. That helped enormously.

Here is the final code for future reference (this one is for the body of the post-mortem)

The main point that tripped me up was that the adf content has to be enclosed by single quotes. In the "data =" line after the first "content" : key note that the entire value is enclosed in single quotes.


postmortemid = '76 .... 6f'
initialURL = ''
URL = initialURL + postmortemid + '/content'

headers = {'Content-Type': 'application/json', 'Authorization': og_key}
data = {"type":"adf", "content":'{"content":[{"type":"heading","attrs":{"level":4},"content":[{"type":"text","text":"Leadup"}]}],"type":"doc","version":1}'}

jsondata = json.dumps(data)

req = requests.put(URL, data=jsondata, headers=headers)

Like # people like this

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events