Skip to content

[Confluence] ConfluenceCloud: fix get_user - #1715

Merged
gonchik merged 1 commit into
atlassian-api:masterfrom
LuisFigueroaG:fix/confluence-cloud-get-user
Oct 31, 2026
Merged

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

Conversation

@LuisFigueroaG

Copy link
Copy Markdown
Contributor

ConfluenceCloud.get_user(user_id) (and Confluence(url="https://<site>.atlassian.net").get_user(...)) sends:

GET /wiki/rest/api/user/{user_id}

The Confluence Cloud v1 REST API doesn't have that endpoint. A user is fetched with GET /wiki/rest/api/user?accountId={accountId} (getUser in the users reference and the v1 OpenAPI spec). The only paths under /user/{userId} are the user property endpoints, so the call always fails with a 404.

This changes get_user to:

  • request GET /wiki/rest/api/user with the account ID in the accountId query parameter, the same endpoint and parameter the Server get_user_details_by_accountid() uses;
  • keep any extra params passed by the caller (for example expand) and add accountId to them.

The argument name and the return value are unchanged.

Tests: updated test_get_user in tests/confluence/test_confluence_cloud.py (it asserted the /user/{id} path) and added two tests, one for extra params and one that checks the final URL is https://test.atlassian.net/wiki/rest/api/user?accountId=557058%3Af58131cb. The three tests fail on master. 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.

Cloud.get_user requests /wiki/rest/api/user/{user_id}, but the v1 user
API has no such endpoint, so the call always fails with a 404. Users
are looked up with GET /wiki/rest/api/user?accountId=..., the same
endpoint and query parameter the Server get_user_details_by_accountid
uses.

Send the account ID as the accountId query parameter instead. Extra
params passed by the caller are kept.
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.47%. Comparing base (450faa7) to head (c97f1f5).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1715   +/-   ##
=======================================
  Coverage   65.47%   65.47%           
=======================================
  Files         107      107           
  Lines       19425    19426    +1     
  Branches     2127     2127           
=======================================
+ Hits        12719    12720    +1     
  Misses       6000     6000           
  Partials      706      706           

☔ 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 d659afe into atlassian-api:master Oct 31, 2026
10 of 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