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: *
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
Looks like the header is set correctly. It might be body that is not encoded correctly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.