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

Closing an alert via API doesn't work

Alexey Labutin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 15, 2024

I have an alert with an alias like:

service@nano-prod||connections||data gateways||data||data://proxy-fg.prod.com

and sending a command to close:

curl -X POST "https://api.eu.opsgenie.com/v2/alerts/service@nano-prod||connections||data gateways||data||data://proxy-fg.prod.com/close?identifierType=alias" -H "Authorization: GenieKey 111b1111144-41111f-11111" -H "Content-Type: application/json" -d '{ "user":"Monitoring Script"}' 

And I get an answer:

{"result":"Request will be processed","took":0.007,"requestId":"d62e7d50-4453-4879-be79-94b25c76ae72"}

Alerts with other aliases are closed with such a response, but in this situation this is not the case. Why? 

1 answer

0 votes
Alan Violada
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 18, 2024

Hey Alexey, Alan from the Opsgenie Support team here.

Testing this, it seems that the issue is that the alias is being parsed incorrectly due to the data:// part of the value - If you check your logs, you are probably going to see something similar to this:

Logs documentation 

Can not execute alert action. There is no open alert with alias 
[service@nano-prod||connections||data gateways||data||data:/proxy-fg.prod.com].

Where we can see that one of the slashes is getting removed

One possible workaround for this would be to use URI encoding to get the value to be parsed correctly, here is an example that worked on my side:

curl --location 'https://api.opsgenie.com/v2/alerts/service%40nano-prod%7C%7Cconnections%7C%7Cdata%20gateways%7C%7Cdata%7C%7Cdata%3A%2F%2Fproxy-fg.prod.com/close?identifierType=alias' \
--header 'Content-Type: application/json' \
--header 'Authorization: GenieKey APIKEY' \
--data '{

}'

 

I hope this helps, and if you need more assistance with your instance, I would recommend creating a support ticket at Atlassian Support.

Cheers,

Alan

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events