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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,465,609
Community Members
 
Community Events
176
Community Groups

Bitbucket API adding/removing permissions

Edited

Greetings,

 I am trying to programmatically create a repository along with certain permissions.

Using the 1.0 API (locally hosted server) I always get a 401 - You are not authorized to access this resource.

I am an admin on the project, and I created the repo.  However, when I try to add a group via the API, I am presented with the unauthorized access error message.

The call looks like this:

PUT /rest/api/1.0/projects/project_name/repos/repo_name/permissions/groups?permission=REPO_ADMIN&name=Bitbucket%20Admins

 

To test that the API works for me, I manually added the group through the web interface. I am a member of the group.

Then I added another group (through the web interface) with REPO_WRITE and REPO_READ.

I attempted to revoke those permissions:

DELETE /rest/api/1.0/projects/project_name/repos/repo_name/permissions/groups?name=Bitbucket%20Users

With this I also get 401 -  You are not authorized to access this resource.

I've read the API documentation and I should meet the requirements to do both of these actions.

for PUT:

"The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource. In addition, a user may not demote a group's permission level if their own permission level would be reduced as a result."  I am a PROJECT_ADMIN.

for DELETE: 

"The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project or global permission to call this resource.

In addition, a user may not revoke a group's permissions if it will reduce their own permission level."

Since I added myself to the repo, I am REPO_ADMIN.

 

 

1 answer

1 accepted

0 votes
Answer accepted

Well, I can't delete my post.  But I solved this and it was completely stupid.  Since I was doing this programmatically (through pycurl) I neglected to copy the authorization function to execute.  So, yeah. 401 makes sense.  :|

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events