Open asqui opened 6 years ago
This is better in v2.0 Beta 3.
The explicit empty-payload form now works:
client.close_alert(alert_id, body=CloseAlertPayload())
However the simplest form which could reasonably be expected to work still fails:
client.close_alert(alert_id) # Fails with: HTTP 400: Bad Request: Invalid JSON body
FYI: I just re-tested to make sure and this is still an issue on v2.0.1
Not all requests require a body, however it looks like the Swagger API does not permit a request with an empty body.
For example, the close alert method does not have any mandatory JSON body fields, which implies you should be able to call it like this:
Or more explicitly:
However both of these fail with:
I believe this section of the Swagger API code is at least partly responsible for this:
https://github.com/opsgenie/opsgenie-python-sdk/blob/master/opsgenie/swagger_client/rest.py#L152
My current workaround is to always specify
source
for these requests.