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

How to use HipChat Put APIs

I'm trying to clean up my HipChat instance in preparation for our move to Slack, one such job is cleaning up room names.

I've found the API for updating a room here, and have grabbed my user auth_token from the "/account/api" page as well with the scope "Administer Room".

From here, I'm using python to run the command, as there's a number of rooms I need to update the name of, my code is as follows for just one room:

import requests, json

URL = ""

PARAMS = {'auth_token': "myAdministerRoomToken",
"name" : "New Room Name Here"}

r = requests.put(url=URL, data=PARAMS)

print(json.dumps(r.json(), sort_keys=True, indent=4)) 

 However, I get the following response:

"error": {
"code": 401,
"message": "Authenticated requests only. See for more information.",
"type": "Unauthorized"

The page linked to in the error code doesn't seem that enlightening, or maybe I'm just dense. (Likely option #2)

I've also tried adding all the required parameters as marked by the API, but I still get the same response. Any ideas what I'm missing?

1 answer

1 accepted

1 vote
Answer accepted

Hi, @Jackson_Farnsworth

My suspicion for now is that you might not have the credentials to perform the action on rooms that you are not an owner / admin of. The logic behind this is that if anyone participants have the ability to do this, room information can change at any time just by having a user creating an API v2 token with the required scope (admin_room) and firing the API call with the parameters. For example, private rooms changed to public which can compromise information. So, let us take one step at a time here.

As of now, can you please confirm if there are any rooms that you own / administer in the group? If yes, let us try to update the room first and verify if the changes gets reflected properly.

Once that is done, try to perform the same update on another room which you are not an admin / owner to confirm the theory. Please let me know how it goes on your end.

I changed the Room ownership to myself, and re-ran the API call, but it still failed with the same error.

Just to be sure, I created a room myself and ran the call, still the same error.

AhmadDanial Atlassian Team Feb 04, 2019

Hi, @Jackson_Farnsworth

I went ahead and tested this on my end and verified that it works with a single room API v2 update:

Check the room name before the update (Private)

Ahmad-Danials-MacBook-Pro:~ ahmaddanialmohammad$ curl -H "Content-Type: application/json" -X GET<token> | python -m json.tool | jq '. | {name}'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1006 100 1006 0 0 782 0 0:00:01 0:00:01 --:--:-- 782
"name": "Private"

Ran the API to update the room with the required properties:

Ahmad-Danials-MacBook-Pro:~ ahmaddanialmohammad$ curl -H "Content-Type: application/json" -X PUT -d "{\"name\": \"Public_2\", \"privacy\": \"private\", \"is_archived\": false, \"is_guest_accessible\" : false, \"topic\":\"This is a new topic\", \"owner\": {\"id\": 898203}}"<token>

Verified that the room name is updated to (Public_2)

Ahmad-Danials-MacBook-Pro:~ ahmaddanialmohammad$ curl -H "Content-Type: application/json" -X GET | python -m json.tool | jq '. | {name}'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1049 100 1049 0 0 935 0 0:00:01 0:00:01 --:--:-- 935
"name": "Public_2"

In this case, I used the API v2 token with the following scope:

Screenshot 2019-02-05 at 08.40.53.png

Can you try to update a single room's name first before attempting it on several rooms using the script?

I have been testing this on just one room until I can get it working.
I've tried your API call with a copy and paste, then replacing the room id, owner id, and auth token to match mine, but I still get that authentication error.

AhmadDanial Atlassian Team Feb 05, 2019

Hi, @Jackson_Farnsworth

Understood. It is a strange behavior indeed. Let us try to tackle this from another perspective. May I know if you are able to generate a new token with the Manage Room and Administer Room scope and test again?

Additionally, can you please provide me with the screen shot on how you have this tested on your end? Do you just make that single line API call through your CLI / terminal or another tool such as POSTMAN? Thanks.

Sorry, I messed up your cURL when copy and pasting (overwrote the owner value with just the ID number, not "{id : #####}". It works now.

Apparently Python for the PUT command will bug out when the auth_token in in the parameters variable, but work fine when appended to the URL. Don't know why, but it works now.

All in all, thanks for your help! 

AhmadDanial Atlassian Team Feb 06, 2019

No worries, @Jackson_Farnsworth. More than happy to help!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Hipchat

Hipchat Cloud and Stride have reached End of Life (updated)

All good things come to an end - thanks to all our customers and partners who have been along the Hipchat and Stride journey with us.  As of Feb 15th 2019, Hipchat Cloud and Stride have reached ...

35,195 views 9 8
Read article

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