kaligne
kaligne

Reputation: 3278

Cannot create Bitbucket repository in team as developer using API

I have a Bitbucket account named myaccount. I am a developer of a team named ateam which does not belong to me. I am not an admin of this team. Developers have their permissions set to create repositories in ateam. I am able to manually create a repository in ateam through bitbucket website's UI. However I am unable to do so using bitbucket's API:

$ curl -X POST -v -u myaccount:mypasswd https://api.bitbucket.org/2.0/repositories/ateam/rep1 -H "Content-Type: application/json" -d '{"is_private": true}'    
Enter host password for user 'myaccount':
*   Trying 104.192.143.5...
* Connected to api.bitbucket.org (104.192.143.5) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.bitbucket.org
* Server certificate: DigiCert SHA2 High Assurance Server CA
* Server certificate: DigiCert High Assurance EV Root CA
* Server auth using Basic with user 'myaccount'
> POST /2.0/repositories/histeam/rep2 HTTP/1.1
> Host: api.bitbucket.org
> Authorization: Basic YWxleGFuZHJlLW5hZGluOmJpdGJ1Y2tldDEy
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 20
> 
* upload completely sent off: 20 out of 20 bytes
< HTTP/1.1 403 FORBIDDEN
< Server: nginx/1.6.2
< Vary: Authorization, Cookie
< Content-Type: application/json; charset=utf-8
< Strict-Transport-Security: max-age=31536000
< Date: Thu, 14 Jul 2016 09:59:27 GMT
< X-Served-By: app-111
< X-Static-Version: 53f44cd8792e
< ETag: "2517d8a35dee8cb8cd9e5f0c889915ba"
< X-Render-Time: 0.0265378952026
< X-Accepted-OAuth-Scopes: repository:admin
< Connection: keep-alive
< X-Version: 53f44cd8792e
< X-Request-Count: 317
< X-Frame-Options: SAMEORIGIN
< Content-Length: 35
< 
* Connection #0 to host api.bitbucket.org left intact
{"error": {"message": "Forbidden"}}

I have forbidden access.

Now the owner of ateam made me the team's administrator. Since then I am able to create a repository in ateam with the very same command as above:

$ curl -X POST -v -u myaccount:mypasswd https://api.bitbucket.org/2.0/repositories/ateam/rep1 -H "Content-Type: application/json" -d '{"is_private": true}' 

The point is I need to create a repository using the API as a developer, not as an admin. It works using the website's GUI but not through the API: Despite having permissions to create repositories, developers are forbidden to do so using the API. So do we have a bug here? If not, am I missing something?


EDIT 1

Here is a screenshot of the Developer's permissions on the team. As one can see, they are supposed to be able to create a repository.

enter image description here

Upvotes: 1

Views: 895

Answers (1)

chhabrakadabra
chhabrakadabra

Reputation: 440

Bitbucket developer here. I agree that that is a bug. And I am actually personally responsible for it :(. So, apologies for that.

I have made a fix and it will be deployed in the next deploy (probably this Tuesday).

Kind regards.

Upvotes: 2

Related Questions