Repository navigation
[Confluence] ConfluenceCloud: add get_page_id - #1704
Merged
gonchik merged 1 commit intoOct 25, 2026
Merged
Conversation
docs/confluence.rst documents get_page_id(space, title, type="page"), and the Server and ConfluenceV2 clients have it, but the Cloud client does not, so Confluence(url="https://<site>.atlassian.net") and ConfluenceCloud raise AttributeError for it. Add get_page_id to Cloud. It reuses the V2 lookup from page_exists (space key -> space-id, then api/v2/pages or api/v2/blogposts for type="blogpost") and returns the ID of the first match, or None.
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.
docs/confluence.rstdocumentsconfluence.get_page_id(space, title, type="page"), and both the Server client andConfluenceV2have it. The Cloud client (Confluence(url="https://<site>.atlassian.net")/ConfluenceCloud) doesn't, so code that worked on 4.x fails with:This came up in #1658, where adding it to Cloud was mentioned but it hasn't landed yet.
This adds
get_page_id(space, title, type="page")toCloud, with the same arguments as the Server client. It uses the same V2 lookup aspage_exists(): resolve the space key withGET /wiki/api/v2/spaces?keys=..., then queryapi/v2/pages(orapi/v2/blogpostsfortype="blogpost", as in #1703) byspace-idandtitle. It returns the first ID as a string, orNonewhen the space or the page isn't found, likeConfluenceV2.get_page_id().To avoid copying that lookup, it moves into a small private helper that both
page_exists()andget_page_id()call.page_exists()sends the same requests and returns the same results as before.Tests: added five
test_get_page_id_*tests totests/confluence/test_confluence_cloud.py(pages, blog posts, not found, unknown space, and a call throughConfluence(url="https://test.atlassian.net")); they fail on master with the error above. The existingpage_existstests pass unchanged. The full pytest suite andtox -e mypypass, and black and flake8 are clean on the changed files. I haven't run it against a real Confluence Cloud site.