I am trying to create a room through the hipchat v2 api

I have a key and it it being sent, but I keep getting this error.  I am posting it to https://api.hipchat.com/v2/room

I am using the Cocoa Rest Client

I got the same response submitting with python.

Could there be something wrong with the endpoint?

{
 "error": {
 "code": "400",
 "message": "The request requires a properly encoded body with the 'content-type' header set to '['application/json']",
 "type": "Bad Request"
 }
}

 

 

These are the headers being sent

Accept: */*
Content-Type: application/json
Authorization: Bearer <key omitted>
Accept-Language: en-us
Accept-Encoding: gzip, deflate

This is the response header

HTTP 400 Bad Request 
Server: nginx
Content-Type: application/json
Access-Control-Expose-Headers: Date, ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-Backoff
X-Ratelimit-Reset: 1470176986
Connection: keep-alive
Date: Tue, 02 Aug 2016 22:24:45 GMT
X-Ratelimit-Limit: 100
Content-Length: 186
X-Ratelimit-Remaining: 100
Access-Control-Allow-Origin: *

2 answers

1 vote
David Maye Atlassian Team Aug 04, 2016

Hi Jim,

I was encountering a similar issue using Postman, however if I run a curl statement it works perfectly fine:

my-macbook-pro:~ dmaye$ curl -d '{"name": "Api_created_room_2"}' -H 'Content-Type: application/json' 'https://<redacted>/v2/room?auth_token='<redacted>'
{"entity": {"id": 7, "is_archived": false, "links": {"participants": "https://<redacted>/v2/room/7/participant", "self": "https://<redacted>/v2/room/7", "webhooks": "https://<redacted>/v2/room/7/webhook"}, "name": "Api_created_room_2", "privacy": "public", "version": "A2NY5UK4"}, "id": 7, "links": {"self": "https://<redacted>/v2/room/7"}}

Not sure if this helps or not, but I thought it was worth mentioning.

Cheers,
-David
HipChat Server Support Engineer | Atlassian

0 votes

Looks like the header is set correctly. It might be body that is not encoded correctly.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 10, 2018 in Hipchat

What should I think about when migrating HipChat to Slack?

...from the beginning. We have built up a lot of content in HipChat, with it being a core tool in our distributed company model. While it is true that we didn’t need to move to Slack immediately, we felt it...

486 views 1 10
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you