when posting via the code using generated header and payload I am getting following error
{"message":"Key format is not valid!","took":0.0,"requestId":"dd21ff02-99d8-4a6e-8712-496c50f3d3b3"}
Per internet resources resources you are supposed to use OPSGenie integration API key, which I am using. It's the Autosys one. When I use the same payload and headers in the Postman, it creates with no issues. Is it possible to find out what the issue could be?
This is the payload and header that code generates
payload
{"priority": "P3", "source": "autosys_monitoring", "message": "AUTOSYS ASI JOB Fail: dro_d_IOVP_chk_alert_resumable", "description": "dro_d_IOVP_chk_alert_resumable Failed on dfwrspdb", "responders": [{"type": "team", "id": "xxxxxx-54ef-4932-xxx-d62ca51dd4d4"}]}
Headers
{'Content-Type': 'application/json', 'Authorization': 'GenieKey xxxxxxx-xxxx-xxxxx-xxxx-xxxxx'}
Url to execute POST
https://api.opsgenie.com/v2/alerts
Hi There,
Thanks for sharing the details! Since your request works in Postman but fails in code with the "Key format is not valid!"
error, it likely comes down to a formatting issue in how your script is sending the request.
A few things to check:
Make sure there are no extra spaces in the Authorization
header (GenieKey YOUR_API_KEY
).
Ensure the payload is properly serialized, for example using json.dumps()
in Python.
Confirm the Content-Type header is correctly set to application/json
.
Double-check that you're using the POST method to https://api.opsgenie.com/v2/alerts
.
If this doesn't solve it, feel free to post a small snippet of your code (excluding the API key), and we can take a closer look.
Best Regards,
Egor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.