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

How can I get azure alertid by GET request response id?

Bohdan Kukliuk
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!
April 4, 2022

Hi,

I create opsgene azure alerts by api requests like this.

https://api.opsgenie.com/v1/json/azure?apiKey=xxxxxxxApiKeyxxxxxxxxx

{
"schemaId": "azureMonitorCommonAlertSchema",
"data": {
"essentials": {
"alertRule": "StorageCheck high message ",
"severity": "Sev3",
"signalType": "Metric",
"monitorCondition": "Fired",
"monitoringService": "Platform",
"firedDateTime": "2020-06-29T18:41:05.7016722Z",
"description": "Test Description",
"essentialsVersion": "1.0",
"alertContextVersion": "1.0"
},
"alertContext": {
"properties": null,
"conditionType": "SingleResourceMultipleMetricCriteria",
"condition": {
"windowSize": "PT1M",
"allOf": [{
"metricName": "SuccessfulRequests",
"metricNamespace": "Microsoft.EventHub/namespaces",
"operator": "GreaterThan",
"threshold": "2",
"timeAggregation": "Total",
"dimensions": [{
"name": "EntityName",
"value": "test-eventhub"
}, {
"name": "OperationResult",
"value": "Success"
}],
"metricValue": 4.0,
"webTestName": null
}],
"windowStartTime": "2020-06-29T18:38:52.06Z",
"windowEndTime": "2020-06-29T18:39:52.06Z"
}
}
}
}

And i want to get alert id by get request.

I tried use this request:
https://api.opsgenie.com/v2/alerts/requests/xxxxxxxRequestsIDxxxxxxxxx

Authorization: GenieKey xxxxxxxApiKeyxxxxxxxxx

Content-Type: application/json

Body {} 

But its return me 403 error The request could not be satisfied.

If request without body its return me message "Request not found. It might not be processed, yet."


I tried another request:

https://api.opsgenie.com/v1/json/azure/alerts/requests/xxxxxxxRequestsIDxxxxxxxxx?apiKey=xxxxxxxApiKeyxxxxxxxxx

Content-Type: application/json

Body {}

But its return me 403 error The request could not be satisfied.

What the correct way to get azure alert id by request id?

2 answers

1 accepted

1 vote
Answer accepted
Nick H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2022

Hi @Bohdan Kukliuk ,

Are you able to run a general List Alerts API call, then use this to GET that specific alert's ID?

If you do that, the request ID will also be returned in the GET on the specific alert.

https://docs.opsgenie.com/docs/alert-api#list-alerts

https://docs.opsgenie.com/docs/alert-api#get-alert

0 votes
Nick H
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2022

Actually - my initial response is not correct. The request ID returned in the GET alert response is the request of that specific API call. 

Without capturing the create alert request ID when the request is completed, I don't believe there is a way to GET it with any of our API calls - besides checking the alert's activity log in Opsgenie, which should capture the request ID here:

reqid.jpg

 

But like mentioned in my past response, you should still be able to use the Alert API to list alerts, and use the alert's ID to run a GET to pull the alert as well.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events