Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I set scope for apiv2 PUT request?

David Ryhn September 8, 2017

I'm working on an integration with a non-hipchat application that i would like to update a room topic on a certain schedule. We keep our Production Support on-call information in PagerDuty and you can create custom REST calls with variables that are sent based on event triggers. I'm trying to get the CURL command working with the /v2/room/room_number/topic API endpoint and i'm getting a 403 forbidden error that says the following. 

"error": 
"code": 403,
"message": "This action requires one of the following scopes: [u'admin_room']",
"type": "Forbidden"


I've tried setting the scope based on what's here
Here are some examples of curl commands i've tried that yeild the same 403 error... so i'm obviously not setting the scope correctly. I've also tried all of these from a REST client to make sure i wasn't screwing up the json format in the curl command and i'm getting the same result.

curl -X PUT '{"topic":"updated topic","capabilities": {"hipchatApiConsumer": {"scopes": ["admin_room"]}}}' -H 'Content-Type: application/json' REQUEST_URL

curl -X PUT '{"topic":"updated topic","scopes":"admin_rooms"}' -H 'Content-Type: application/json' REQUEST_URL
I've also tried creating a "group admin" token with the role of "admin" and i just get an invalid oauth session message when i tack the token on the end of the request URL. 
Can someone provide the correct json for setting this scope in the request, or explain how i'm supposed to be creating the token differently? I feel like i've exhausted my UI options, and I've been searching thuroughly without finding a solution. 

1 answer

0 votes
ryebenedict
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 15, 2017

Hey David!


You should be able to create an APIv2 token with admin_room Scope via https://<your-team-domain>.hipchat.com/account/api > Create new token and select the admin_room Scope.

(!) Do note that you can select multiple Scopes to extend your token's capability.

Also, I'd like to encourage you to reach out to our Ecosystem Support Portal to work with our Dev Support team for advice on how you can make your Custom Integration work with HipChat. :)

Hope this helps!

David Ryhn September 15, 2017

Thank you so much Ryan!! I didn't realize i needed to hit that URI to make the tokens i was going into "group admin" to make the tokens. You rock man! Have a great day : ) 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events