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

Alerts API - Close Alert

I've made a few successful API calls using the same integration key (Get Alerts, Update Description, Add Tag), but while trying to CLOSE ALERT, I get "The remote server returned an error: (400) Bad Request"

Any idea what I could be missing here?


PS C:\> $closeAlertURL

PS C:\> Invoke-RestMethod -Method POST -Uri $closeAlertURL -Headers $global:OpsGenieAPIHeader

Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At line:1 char:1
+ Invoke-RestMethod -Method POST -Uri $closeAlertURL -Headers $global:O ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand


1 answer

1 accepted

0 votes
Answer accepted

I figured out the problem.

Even though I'm not using any of the OPTIONAL fields in the JSON body, I MUST have an empty JSON body passed with the request.

Here's what worked for me:


PS C:\Windows\System32> $closeAlertURL

PS C:\> $post_message = @{}
$post_message_JSON = $post_message | ConvertTo-Json

PS C:\> Invoke-RestMethod -Method POST -Uri $closeAlertURL -Headers $global:OpsGenieAPIHeader -Body $post_message_JSON


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

223 views 0 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you