Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a 401-Unauthorized Error on REST API

Stanislav Vincent
May 29, 2019

I am using Confluence Cloud. All worked perfectly but suddenly (max 1 months ago) my REST API call stopped working and it returns me an unauthorized error. I have tried both basic authentication call which I do believe are 100% correct. When I use URL in the browser when I am logged into the Confluence all works fine.

My commands:

1) curl -u s.vincent@gmc.net:PASSWORD -X GET "https://gmcwiki.atlassian.net/wiki/rest/api/content?orderby=history.createdDate%20desc&expand=space,history,metadata.labels&type=page&spaceKey=PKB&limit=100&start=0"

2) curl -X GET -H "Authorization: Basic BASE64TOKEN" -H "Content-Type: application/json" "https://gmcwiki.atlassian.net/wiki/rest/api/content?orderby=history.createdDate%20desc&expand=space,history,metadata.labels&type=page&spaceKey=PKB&limit=100&start=0"

I set up basic authentication based on this article.

Found among the articles that it could be caused my CAPTCHA in case log-in failed more times. First, of I am never asked for CAPTCHA when I am logging in but in Security Configuration is set to 3 and cannot be disabled.

I have tested API call in Postman as well and the result is the same unauthorization error.

Does anyone have any hint? Thanks

1 answer

1 accepted

1 vote
Answer accepted
MatthewC
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 Champions.
October 2, 2012

In short the answer is no.... The way permissions work is that they are most open at the space level and become more restricted the further down the page hierarchy you go.

So to be able to edit ANY page in the space, they have to have space edit rights.

The only think you can do is change the structure of your space. Where the pages which are for colloboration are in one tree, and the pages which are not for editing are in another tree off the home page. You can then set the page restrictions in one place and every page under that will inherit the restrictions.

In summary, at the page level. you can only take away permissions, not grant them.

References: https://confluence.atlassian.com/display/DOC/Page+Restrictions

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events