[Confluence] Fix pagination for get_all_* methods and unify _get_paged across Cloud/Server#1616
Open
Zircoz wants to merge 1 commit intoatlassian-api:masterfrom
Open
[Confluence] Fix pagination for get_all_* methods and unify _get_paged across Cloud/Server#1616Zircoz wants to merge 1 commit intoatlassian-api:masterfrom
Zircoz wants to merge 1 commit intoatlassian-api:masterfrom
Conversation
8c2f7f9 to
ea2fa33
Compare
…d across Cloud/Server Fixes atlassian-api#1598 Fixes atlassian-api#1480 - Switch 10 get_all_* methods to use _get_paged for full pagination - Unify _get_paged into ConfluenceBase (remove Cloud/Server duplicates) - Handle _links.next as both string and dict formats - Fix relative pagination URLs by prepending base URL correctly - Fix Cloud api_root from wiki/api/v2 to wiki/rest/api (endpoints use v1 paths) - Recognize api.atlassian.com in Cloud detection; support explicit cloud= kwarg - Add routing tests and pagination edge-case tests for both Cloud and Server Co-Authored-By: Claude Opus 4.6 <[email protected]>
This was referenced Feb 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1598
Fixes #1480
Multiple
get_all_*methods (get_all_pages_from_space,get_all_pages_from_space_trash,get_all_draft_pages_from_space, etc.) only returned the first page of results because they calledself.get()directly instead ofself._get_paged(). Additionally, pagination broke when the Confluence API returned_links.nextas a plain URL string rather than a{"href": "..."}dict.Changes
Pagination fix (core issue)
get_all_*methods to use_get_pagedon both Server and Cloud, so they now return fully-paginated generators instead of single-page dicts_get_pagedintoConfluenceBase— removed duplicate implementations fromConfluenceCloudBaseandConfluenceServerBase, replacing them with a single method in the shared base class that handles bothstranddictformats for_links.next/rest/api/content?cursor=1), the base URL is now correctly prepended by stripping theapi_rootsuffix, preserving Cloud API gateway routing prefixesCloud URL/routing fixes
api_rootfromwiki/api/v2towiki/rest/api— the previous default was incorrect: every endpoint in the Cloud class uses v1 REST API paths (content/{id},space/{id},content/search?cql=, etc.), but they were being prefixed with the v2 base path (wiki/api/v2). The v2 API has an entirely different resource model (pages/{id},spaces/{id}, no CQL search) so the old configuration produced invalid URLs. This is a bugfix, not a v2→v1 downgrade.api.atlassian.comin Cloud detection — theConfluencewrapper now correctly routes OAuth2 API gateway URLs toConfluenceCloudcloud=kwarg — allows users to force Cloud or Server routing regardless of URL heuristicsTests
test_confluence_routing.py— covers.atlassian.net,.jira.com,api.atlassian.com, self-hosted URLs, and explicitcloud=True/Falseoverridehref,Nonenext link, noresultskey, and relative next link resolutionget_all_*methodsBreaking change
get_all_pages_from_space,get_all_blog_posts_from_space,get_all_pages_by_label,get_all_blog_posts_by_label,get_all_draft_pages_from_space,get_all_draft_blog_posts_from_space,get_trash_content,get_all_pages_from_space_trash, andget_all_blog_posts_from_space_trashnow return generators (from_get_paged) instead of dicts. Callers that accessedresult["results"]must switch to iterating the return value directly (e.g.list(result)).Test plan
pytest tests/confluence/— all new and updated tests passget_all_pages_from_spacereturns all pages (not just first 25) on a Confluence Server instance with >25 pagesapi.atlassian.com/ex/confluence/...) route and paginate correctly🤖 Generated with Claude Code