It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Getting http 400 error on statuspage.io incident post

DaveH Oct 10, 2018

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.

 

2 answers

1 accepted

0 votes
Answer accepted
DaveH Oct 10, 2018

I've resolved this issue -- I was not sending the correct Content-Type and Content-Length headers.  With Content-Type set to "application/x-www-form-urlencoded" and Content-Length set to the post data length, I got back the expected 201 (success) status.

0 votes
DaveH Oct 10, 2018

After a bit more reading, I've corrected one issue (the component_ids parameter), but still getting the 400 error.

The post data object is:

{

"incident[name]": "Network routing issue",

"incident[status]": "identified",

"incident[body]": "This is a test message body. Had this been a real incident, this would have hopefully contained some useful information.",

"incident[component_ids]": [ "bk60bdqdqv7g" ]

}

The post data string is:

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=bk60bdqdqv7g

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Statuspage

Statuspage has 3 new integrations with Zendesk!

Incident response is a team sport, and customer support is an integral part of any team. While Ops is working hard to solve the problem at hand, support is on the front lines communicating with custo...

283 views 0 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you