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.

HipChat Server Support Engineer | Atlassian

0 vote

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

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Published Oct 07, 2017 in Hipchat

Bringing Structure to your HipChat Instance

...have mention name FirstnameLastname. Fe.: @MaartenCautreels This certainly helps to know who is being mentioned in a conversation. Imagine your colleague sends the following message...

464 views 1 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot