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,364,125
Community Members
 
Community Events
168
Community Groups

Why is the REST API saying I don't have sufficient read permissions?

Edited

I'm attempting to use the Bamboo REST API, but no matter the endpoint I hit I get receive a 401 error with the following message -

You do not have sufficient read permissions

For example, to view specific results for a build plan, I'm using basic auth and hitting this URL - https://my.bamboo.url/rest/api/latest/deploy/result/PROJ-PLAN/546?os_authType=basic

The user that I am authenticating with can view the plan via Bamboo using the exact same credentials (and has full admin privileges), so I don't think the issue is related to permissions - https://my.bamboo.url/browse/PROJ-PLAN-546

Looking at the docs, I can't see any requirement for query parameters or headers that may be causing my issue. Is anyone able to suggest why the REST API is not returning a happy result?

Thanks,
David

2 answers

1 accepted

2 votes
Answer accepted
rsperafico Atlassian Team Sep 17, 2018

Hi @David Gard,

Thank you for your inquire.

Would you mind going to https://docs.atlassian.com/atlassian-bamboo/REST/ as this is the root page for Bamboo's REST API documentation. Please, select the Bamboo version you are running or a closer version and copy/paste the endpoint you are experiencing issues with. The link you have provided relates to Bamboo v5.5.0 (https://docs.atlassian.com/atlassian-bamboo/REST/5.5.0/).

For example, to view specific results for a build plan, I'm using basic auth and hitting this URL - https://my.bamboo.url/rest/api/latest/deploy/result/PROJ-PLAN/546?os_authType=basic

The endpoint above suggests you are requesting results from a Deployment (/rest/api/latest/deploy...) and not from a build plan as you mentioned.

Also, "os_authType=basic" is not required when consuming a REST API endpoint.

Kind regards,

Rafael

Hi Rafael,

The URL was a typo - https://my.bamboo.url/rest/api/latest/result/PROJ-PLAN/546

As described in my above reply, now that I have logged in via Chrome, I seem to be logged in full stop - even if I pass a deliberately invalid username/password via Postman.

Taking a look at the link you gave me, the /results endpoint seems to be the same for v5.5.0 and v6.1.1.

Thanks,
David

rsperafico Atlassian Team Sep 17, 2018

Hi @David Gard,

As described in my above reply, now that I have logged in via Chrome, I seem to be logged in full stop - even if I pass a deliberately invalid username/password via Postman.

The above described seems to be related to cookie/session. Instead, you should be testing it as cURL. With that said, please run the following cURL command:

# replace USERNAME so you can authenticate in Bamboo
# user must have VIEW permission to given planKey
# replace http://localhost:8085 with Bamboo's URL
# replace PROJ-PLAN-546 with build result

curl -k -u USERNAME \
     -H 'Content-type: application/json' \
     -H 'Accept: application/json' \
     -X GET http://localhost:8085/rest/api/latest/result/PROJ-PLAN-546

If you are looking for a JOB result, you would replace PROJ-PLAN-546 with PROJ-PLAN-JOB1-546.

Please, let us know how it goes.

Kind regards,

Rafael

It does indeed seem to be some sort of Chrome frustration, however it's bazaar that the API isn't trying to authenticate for every use.

It's also odd that I can now connect via the likes of PowerShell and CURL, when before I had logged in via Chrome I was unable to do so.


Thanks,
David

rsperafico Atlassian Team Sep 17, 2018

Hi @David Gard,

I am glad we could help you somehow.

Please, do not hesitate on raising your inquire(s) in Atlassian Community whenever needed.

Have a great week!

Kind regards,

Rafael

Hello David,

If you paste your URI for your API call into a browser (same browser you're logged into Bamboo with) do you get a JSON return?

Also, check CAPTCHA to ensure it has not triggered for your REST API account.

Hi Stephen,

Pasting the URL in to a browser window prompts me for a username/password and does then return the valid JSON that I'm looking for. Now that I have logged in this way (via Chrome), the request is working in Postman, regardless of what username/password I set. In fact, I can remove authentication altogether and it still works.

In the long run I plan to call the API from an Azure Function App, so having to log in frist won't be an option. Do you have any ideas about what's happening here, and why Bamboo is seeming behaving in an unpredictable manner?

Also, according to User Management, the user in question has 0 of 3 failed captcha attempts.

Thanks,
David

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events