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

Find the post-mortem assocaied with an incident via API

Wolfgang Kandek December 13, 2022

I would like to find the post-mortem associated with an incident via the API, but I cannot find the post-mortem reference in the the Incident itself.

There is an incident in the post-mortem API, but there seems no also seems no way to list post-mortems.

My purpose is to ensure that P1/P2 incidents have a post-mortem and that it follows out format and agreements (for example - a Jira ticket is needed for each Action item). The initial ideas was to list Incidents that are closed/resolved and see whether they have a post-mortem. If so get the post-mortem and review the content for format and ticket links. If not, create post-mortem in our format and notify the incident owner that a post-mortem skeleton had been created.

 

1 answer

1 vote
Darryl Lee
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 15, 2022

Hi @Wolfgang Kandek,

This is Darryl. I am here to help. 😀

Understand that you would like to leverage Opsgenie Incident API to list out the Opsgenie Incidents which don't have a Postmortem yet.

The endpoint

https://api.opsgenie.com/v1/incidents?query=postmortemStatus%3Ano-postmortem

Reference

We recommend tailoring the `query` inline parameter in the URL when making the API request.

The List Incident API documentation is -> https://docs.opsgenie.com/docs/incident-api#list-incidents

The Search Syntax for Incidents documentation is a great reference for you to adjust your query -> https://support.atlassian.com/opsgenie/docs/search-syntax-for-incidents/

Last, please encode the URL with the reference -> https://www.w3schools.com/tags/ref_urlencode.ASP


Hope this helps.

Kind regards,
Darryl Lee
Support Engineer, Atlassian

Wolfgang Kandek December 15, 2022

Daryl, that helps with one of my issues, i.e. an incident that does not have a post-mortem.

But I would also like to access the incidents that have a post-mortem and verify the format used:

- Sections that we have as mandatory
- Jira tickets for action items
- etc

John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 16, 2022

Hi @Wolfgang Kandek,

You can use the following query parameters for postmortemStatus:

  • no-postmortem
  • published
  • in-review
  • draft

If you want to only include incidents that have a published postmortem, you can use the following endpoint with 'published' as the value for the 'postmortemStatus' query parameter:

Wolfgang Kandek December 16, 2022

From those queries that return incidents how do I find the associated post-mortem?

John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 16, 2022

@Wolfgang Kandek You would need to use the Get Postmortem Request API, using the incident ID returned from the List Incidents endpoint. 

https://docs.opsgenie.com/docs/postmortem-api#get-postmortem-request

Wolfgang Kandek December 16, 2022

John, that requires the postmortemid? Where do I get it from?

John M
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 16, 2022

It looks like right now the only way to get the postmortemid is to create a postmortem via the API (in which case it will return the id) or in the UI, go to Analytics >> postmortem reports (id is in the URL)

I have found that there is a feature request to add this functionality to the API:

https://jira.atlassian.com/browse/OPSGENIE-41

Like # people like this
Jazz Tong June 20, 2023

hi, 

We have a similar use case as well, what is the workaround at this moment, Is the UI seen as able to provide the association, and what is the equivalent to API?

Suggest an answer

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

Atlassian Community Events