'Closing Alerts on Opsgenie via Python Integration

I'am using opsgenie_sdk import for creating alerts on Opsgenie, creating part was successful but having troubles while closing it.

My open alert has an alias which name is 'python_sample',

Here is the code i run,

configuration = opsgenie_sdk.Configuration()
configuration.api_key['Authorization'] = 'my_api_key'
configuration.host = 'https://api.eu.opsgenie.com'
api_instance = opsgenie_sdk.AlertApi(opsgenie_sdk.ApiClient(configuration))
identifier = 'python_sample'
identifier_type = 'alias' 

try:
    create_response = api_instance.close_alert(identifier,identifier_type=identifier_type)
    
    print(create_response)
except opsgenie_sdk.ApiException as err:
    print("Exception when calling AlertApi->create_alert: %s\n" % err)

Response is "HTTP response body: {"message": "Body should be a JSON object", "took": 0.001, "requestId": "fc080f49-a6c6-4968-9bd8-acfd920cf74d", "url": "https://api.eu.opsgenie.com/v2/alerts/python_sample/close"}"

What is the problem here, any help would be appreciated. Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source