Forums

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

How to get alertId on alert creation?

Michał Margula May 21, 2025

Hi,

I am creating simple integration that would allow us to open and close alerts in JSMOPS. Creation works as expected, no issues here. Problem is with closing an alert, but according to https://developer.atlassian.com/cloud/jira/service-desk-ops/rest/v2/api-group-alerts/#api-v1-alerts-id-close-post (or https://developer.atlassian.com/cloud/jira/service-desk-ops/rest/v1/api-group-integration-events/#api-jsm-ops-integration-v2-alerts-id-close-post) we need id. Unfortunately on creation of alert we don't get its id.

I have few questions related to this:

- is it possible to create alert and get its id at the same time?

- if not, how can I close alert not knowing the id? can I use alias instead? listing alerts to get id seems quite expensive way to do it

 

Thanks

Michał

1 answer

1 accepted

0 votes
Answer accepted
Tom Russell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2025

@Michał Margula unfortunately, because alert creation is an asynchronous process, you need to save the request ID from the alert creation call, then periodically call Get Request Status (https://developer.atlassian.com/cloud/jira/service-desk-ops/rest/v2/api-group-alerts/#api-v1-alerts-requests-id-get) until the alert is processed and the alert ID is returned.

For closing an alert; in the old Opsgenie API (https://docs.opsgenie.com/docs/alert-api#close-alert) there is a parameter (identifierType) that allowed you to specify that the ID was the alias. I don't see that in the JSM Ops Alert API. You could try adding that parameter and see if it's implemented, but not documented. If it doesn't work, there's probably a case to be made with Atlassian to add that parameter.

Michał Margula May 22, 2025

Hey @Tom Russell 

It seems that `?identifierType=alias` still works! I would never thought of trying that out. 

Cheers

M.

Like Tom Russell likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events