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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.