Using the JavaScript for Webhook onto OpsGenie, the following happens:
- Event occurs, and it is sent properly to OpsGenie and an Alert is opened. On the data received back I have an RequestID (example):
- The webhook then will try to fetch details from the aforementioned RequestID, using: Sending request:
This second call, I understand is to receive proper information from the recently opened Alert (called Get-Alert) but that one, I am getting an error 400 when fired from the webhook.
If I do the same, similar request via bash with cURL, it just works...
I am quite empty of ideas by now... anyone seen this?
In an Update: Anyone know if there is some way to dump the headers of the request before sending ?
I am looking on the source (5.2) and I only see methods like AddHeader and ClearHeader, I can't see the name of the object to dump the var, do anyone know what is it?
I figured now that, if the request is sent without a Header setting of "Host: api.opsgenie.com" he gives a 400 on bash/curl... although when added the Header on the script, I am uncertain if the header is really sent out...
- Event occurs, and it is sent properly to OpsGenie and an Alert is opened. On the data received back I have an RequestID (example):
Code:
b9aeaaaa-2aaa-4aaa-aaaa-5aaaaaaa3326
Code:
https://api.opsgenie.com/v2/alerts/requests/b9aeaaaa-2aaa-4aaa-aaaa-5aaaaaaa3326
Code:
Received response with status code 400 <!DOCTYPE HTML PUBLIC "- //W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The request could not be satisfied</TITLE> </HEAD><BODY> <H1>400 ERROR</H1> <H2>The request could not be satisfied.</H2> <HR noshade size="1px"> Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configurat ion error. Try again later, or contact the app or website owner. <BR clear="all"> If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this err or by reviewing the CloudFront documentation. <BR clear="all"> <HR noshade size="1px"> <PRE> Generated by cloudfront (CloudFront) Request ID: 1NnEUWg6mC8BsuyobgSK_CtB0-a6U61W4CFOKHHfsMTdH7k7XX46Dg== </PRE> <ADDRESS> </ADDRESS> </BODY></HTML>
Code:
$curl -XGET -H 'Content-Type: application/json' -H 'Authorization: GenieKey ffblafff-fdbl-u60a-c4c1-kkkk6blabla7' https://api.opsgenie.com/v2/alerts/requests/b9aeaaaa-2aaa-4aaa-aaaa-5aaaaaaa3326
{"data":{"success":true,"action":"Create","process edAt":"2020-09-04T10:04:41.308Z","integrationId":"1baaaa45-6bc0-48
45-8e93-038bbbbbbf0f","isSuccess":true,"status":"Created alert","alertId":"8722cccc-8c7b-47f5-9ff5-3ecgggggggg7-1599
213881259","alias":"99212345"},"took":0.007,"reque stId":"2ffffffe-2741-4019-86f2-d2cdbfffffff"}
In an Update: Anyone know if there is some way to dump the headers of the request before sending ?
I am looking on the source (5.2) and I only see methods like AddHeader and ClearHeader, I can't see the name of the object to dump the var, do anyone know what is it?
I figured now that, if the request is sent without a Header setting of "Host: api.opsgenie.com" he gives a 400 on bash/curl... although when added the Header on the script, I am uncertain if the header is really sent out...
Comment