I'm using node.js to post incidents to our statuspage.io and getting a 400 error. Based on the API docs, which show Curl examples, I'm formatting the post data as:
var postData = querystring.stringify({
'incident[name]': "Network routing issue",
'incident[status]': "identified",
'incident[body]': "body text...",
'incident[component_ids][]': "bk60bdqdqv7g",
'incident[components][bk60bdqdqv7g]': "degraded_performance"
});
The raw postData result string looks like:
postData="incident%5Bname%5D=Network%20routing%20issue&incident%5Bstatus%5D=identified&incident%5Bbody%5D=This%20is%20a%20test%20message%20body.%20%20Had%20this%20been%20a%20real%20incident%2C%20this%20would%20have%20hopefully%20contained%20some%20useful%20information.&incident%5Bcomponent_ids%5D%5B%5D=bk60bdqdqv7g&incident%5Bcomponents%5D%5Bbk60bdqdqv7g%5D=degraded_performance"
I'm sure that I'm not correctly translating the Curl example to javascript object.
Any pointers, examples, advice would be greatly appreciated.