Skip to content

[Confluence] ConfluenceCloud: add get_page_id - #1704

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

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

Conversation

@LuisFigueroaG

Copy link
Copy Markdown
Contributor

docs/confluence.rst documents confluence.get_page_id(space, title, type="page"), and both the Server client and ConfluenceV2 have it. The Cloud client (Confluence(url="https://<site>.atlassian.net") / ConfluenceCloud) doesn't, so code that worked on 4.x fails with:

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

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") to Cloud, with the same arguments as the Server client. It uses the same V2 lookup as page_exists(): resolve the space key with GET /wiki/api/v2/spaces?keys=..., then query api/v2/pages (or api/v2/blogposts for type="blogpost", as in #1703) by space-id and title. It returns the first ID as a string, or None when the space or the page isn't found, like ConfluenceV2.get_page_id().

To avoid copying that lookup, it moves into a small private helper that both page_exists() and get_page_id() call. page_exists() sends the same requests and returns the same results as before.

Tests: added five test_get_page_id_* tests to tests/confluence/test_confluence_cloud.py (pages, blog posts, not found, unknown space, and a call through Confluence(url="https://test.atlassian.net")); they fail on master with the error above. The existing page_exists tests pass unchanged. The full pytest suite and tox -e mypy pass, and black and flake8 are clean on the changed files. I haven't run it against a real Confluence Cloud site.

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.
@gonchik
gonchik merged commit 385bc88 into atlassian-api:master Oct 25, 2026
3 of 9 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