Accessing Bibucket license details API calls.

Natarajan Anandbabu (SEIT) April 30, 2020

Hi Team,

We are trying to fetch the license details of our Bitbucket product through API calls using Personal Access tokens.

we are getting 401 Unauthorized access error.Please find the error details.

The remote server returned an error: (401) Unauthorized.

API Used: https://bitbuckethosturl/rest/api/1.0/admin/license

I have created the token for an admin account.we are able to view the license details in the UI but when tried through API we are getting above exception.

Please let us know how we can fix this authentication issue. Let me know if anything  i need to change in my settings.

Awaiting for your reply.

Thanks

1 answer

0 votes
Lasse Langhorn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 30, 2020

Hi,

My experience with Bitbucket REST API is that personal access tokens cannot be used with administrator related REST endpoints.

I am not sure why.

So, for admin related REST endpoints basic auth may be the way to go but not ideal. I would prefer personal access tokens over basic auth.

Basic AUTH:

curl -v -X GET -u admin-username:password https://bitbuckethosturl/rest/api/1.0/admin/license

Response HTTP 200 with license info.

Personal access token:  

curl -v -X GET -H "Authorization: Bearer MTQ1NTY0MDA4OTEwOtAOXXXXXXXXX" https://bitbuckethosturl/rest/api/1.0/admin/license

Response HTTP 401

Bitbucket access tokens and Bitbucket

Regards

Lasse Langhorn

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events