Skip to content

[Confluence] ConfluenceCloud: add get_user_details_by_accountid - #1716

Merged
gonchik merged 1 commit into
atlassian-api:masterfrom
LuisFigueroaG:fix/confluence-cloud-get-user-details-by-accountid
Nov 4, 2026
Merged

gonchik merged 1 commit into
atlassian-api:masterfrom
LuisFigueroaG:fix/confluence-cloud-get-user-details-by-accountid

Conversation

@LuisFigueroaG

Copy link
Copy Markdown
Contributor

The Server client has get_user_details_by_accountid(accountid, expand=None), but the Cloud client (Confluence(url="https://<site>.atlassian.net") / ConfluenceCloud) doesn't, so the call fails with:

AttributeError: 'Cloud' object has no attribute 'get_user_details_by_accountid'

This adds it to Cloud with the same arguments as the Server method. It calls get_user() (fixed in #1715), so it sends:

GET /wiki/rest/api/user?accountId={accountid}

with expand added when given. That's getUser in the Cloud v1 users reference, which takes accountId and expand (operations, personalSpace). Like the Server method, a 403 raises ApiPermissionError and a 404 raises ApiNotFoundError.

I didn't add get_user_details_by_username or get_user_details_by_userkey to Cloud, since Cloud no longer accepts username or key on that endpoint.

docs/confluence.rst didn't list get_user_details_by_accountid yet, so I added it under "Users and Groups" with a note that the Cloud client has it too.

Tests: added five test_get_user_details_by_accountid* tests to tests/confluence/test_confluence_cloud.py. They cover the request params, the final URL with expand (https://test.atlassian.net/wiki/rest/api/user?expand=personalSpace&accountId=557058%3Af58131cb), the 403/404 errors, and a call through Confluence(url="https://test.atlassian.net"). All five fail on master with the error above. The full pytest suite, tox -e mypy, bandit and doc8 pass, and black and flake8 are clean on the changed files. I haven't run it against a real Confluence Cloud site.

The Server client has get_user_details_by_accountid, but the Cloud
client does not, so Confluence(url="https://<site>.atlassian.net") and
ConfluenceCloud raise AttributeError for it.

Add it to Cloud with the same arguments. It goes through get_user, so
it requests GET /wiki/rest/api/user?accountId=... (plus expand when
given), and maps 403 and 404 to ApiPermissionError and
ApiNotFoundError like the Server method.
@codecov

codecov Bot commented Oct 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.48%. Comparing base (d659afe) to head (8b5e62d).

Files with missing lines Patch % Lines
atlassian/confluence/cloud/__init__.py 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1716   +/-   ##
=======================================
  Coverage   65.47%   65.48%           
=======================================
  Files         107      107           
  Lines       19426    19436   +10     
  Branches     2127     2129    +2     
=======================================
+ Hits        12720    12728    +8     
- Misses       6000     6001    +1     
- Partials      706      707    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gonchik
gonchik merged commit ac90e5d into atlassian-api:master Nov 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants