I am trying to create alert for user type but I am getting below error.
import requests
def opsGenieAlertCreation():
authorization_token: str = 'GenieKey {0}'.format("xxxxxx-xxxx")
headers = {
'Content-Type': 'application/json',
'Authorization': authorization_token
}
#incidentEscaltionOpsgenieTeamId = ops_genie_teamid
incidentEscaltionOpsgeniePriority = "P1"
api_url = 'https://api.opsgenie.com/v2/alerts'
alert_data = {
"message": "New incident was created",
"responders": [
{
"type": "user",
"id": "xxx@gmail.com"
}
],
"description": "test description",
"priority": incidentEscaltionOpsgeniePriority,
"tags": ["Incident", "Monitoring"]
}
response = requests.post(api_url, json=alert_data, headers=headers)
#calling above function
opsGenieAlertCreation()
Hey Anshu, Alan from the Opsgenie Support team here.
In this case, you want to make sure that the API key you are using is from an API integration - All instances have the "Default API" integration, but you can also create your own:
Cheers,
Alan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.