Hello, I try to query someone's information through get_user_details_by_username provided in confluence.py from atlassian-python-api package,which can be found in https://atlassian-python-api.readthedocs.io/confluence.html . It works well in confluence DC when url is "https://your-confluence-server.com" .
But if url is "https://your-domain.atlassian.net" which means Cloud site,it response 400.
My code is like:
detail = confluence.get_user_details_by_username('zhichaow', expand=None)
Here is detailed output after running:
2025-09-02 07:30:21,054 - atlassian.rest_client - DEBUG - curl --silent -X GET -H 'Content-Type: application/json' -H 'Accept: application/json' 'https://internal-nvidia-uat2.atlassian.net/wiki/rest/api/user?username=zhichaow'
2025-09-02 07:30:21,117 - urllib3.connectionpool - DEBUG - https://internal-nvidia-uat2.atlassian.net:443 "GET /wiki/rest/api/user?username=zhichaow HTTP/11" 400 None
2025-09-02 07:30:21,118 - atlassian.rest_client - DEBUG - HTTP: GET rest/api/user -> 400 Bad Request
2025-09-02 07:30:21,118 - atlassian.rest_client - DEBUG - HTTP: Response text -> {"statusCode":400,"data":{"authorized":true,"valid":true,"errors":[],"successful":true},"message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: Username/Userkey are not accepted as parameters."}
Could anyone help me query user details in Cloud correctly?
Hi @Zhichao Wei
On Cloud username/userkey doesn't work. You have to use accountId if you want to retrieve a specific user. I believe that API is just for backward compatibility and doesn't reflect the actual work. Also, based on the error, it mentions that username/key are not accepted parameters.
Thanks. Do you konw why this method is deprecated in Cloud? Will the atlassian-python-api update to support retrieve user by account ID?
Actually, I need to add @someone link in page content using python script so it depends on retrieve user by name. For example,I can add @Zhichao Wei into my page body after using userKey = get_user_details_by_username('zhichaow') and add statement in page source:
<ac:link>
<ri:user ri:userkey={userKey} />
</ac:link>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It was deprecated in favor of accountId as mentioned on this document.
I'm not sure about that if the author of the library would do that but I highly doubt they can do anything about it.
I would say typically the way userkeys were generated in the past was the prefix of an email address e.g. exampleuser@example.com, the userkey would be exampleuser maybe backward compatibility may work for now but its not guaranteed later.
However, if you're looking into identifying users, then you need to fetch the accountId beforehand to use in your Confluence tag.
You can also refer to this post as well which answers a similar question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks~
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.