Forums

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

The calling user does not have permission to view users

Rob Howard
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 18, 2024

I am on a 14-day trial to decide whether to propose a Confluence solution to clients.
I am trying to determine the viability of accessing Confluence with Python.
I am the admin of the site and I am the only user.
I have created a API token, not yet expired.

My code:

# pip install atlassian-python-api
# Python 3.11
from atlassian.confluence import Confluence

url = 'https://xxx.atlassian.net'
token = 'ATATT3x...wI7c34=4EA6D8ED'

confluence = Confluence(url=url, token=token)
user = confluence.get_user_details_by_accountid('712020:c9586404-a094-4c1f-8c28-bd78a644b3a8')


RETURNS: The calling user does not have permission to view users

WHEN I log into my browser and replace the URL with

https://xxx.atlassian.net/wiki/rest/api/user?accountId=712020:c9586404-a094-4c1f-8c28-bd78a644b3a8


IT WORKS, and returns expected user data.

I have also tried these patterns:


confluence = Confluence(url=url, username='MY EMAIL ADDRESS', password='****')
confluence = Confluence(url=url, username='MY USER NAME', password='****')
confluence = Confluence(url=url, username='MY USER NAME', password='****')
confluence = Confluence(url=url, username='MY USER NAME', password='****', token=token)


and every type of combination I could think of.
I have tried other various APIs, like reading all documents, only to get a similar 401 error.

Is this an issue with the 14-day trial?
Or something I'm just doing wrong?

2 answers

0 votes
Rob Howard
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 19, 2024

UPDATE: There seems to be something wrong (bug) with the python library when it comes to parsing my token. It returns: "Failed to parse Connect Session Auth Token"
My token contains "=", "-", and "_" characters in it.


If I just hit the API directly, it works:

url = 'https://xxx.atlassian.net/wiki/rest/api/user?accountId=712020%3Ac9586404-a094-4c1f-8c28-bd78a644b3a8'
headers={
'Accept': 'application/json',
'Content-Type': 'application/json'
}
params = {
"spaceKey": 'Documentation',
"type": "page",
"limit": 1000
}
response = requests.get(url, headers=headers, auth=(username, token))
print(response.text)
0 votes
Benjamin
Community Champion
January 18, 2024

HI @Rob Howard ,

 

Looks like a similar issue another member had. 

 

https://community.atlassian.com/t5/Confluence-questions/The-calling-user-does-not-have-permission-to-view-the-content/qaq-p/2185802

It could possibly be a trial but logically there shouldn't be a restriction for API calls.  You are able to call the API via browser with your login, so your user is ok. Also, you renew your token to make sure it valid still and not expire. Maybe worth a Atlassian support ticket to check.

 

https://support.atlassian.com/contact/?postauth=true#/

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD Trial
TAGS
AUG Leaders

Atlassian Community Events