I am trying to create alert for user type but I am getting below error.
import requestsdef 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 functionopsGenieAlertCreation()
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:
Create an API integration
Cheers,
Alan
It looks like you're new here. Sign in or register to get started.