Skip to content

[Confluence] ConfluenceCloud: add remove_page - #1705

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

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

Conversation

@LuisFigueroaG

Copy link
Copy Markdown
Contributor

docs/confluence.rst documents confluence.remove_page(page_id, status=None, recursive=False), and the Server client has it. The Cloud client (Confluence(url="https://<site>.atlassian.net") / ConfluenceCloud) doesn't, so deleting a page fails with:

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

The only option on Cloud today is delete_content(), which has no status or recursive and returns something different, so code written against 4.x has to be changed for Cloud.

This adds remove_page(page_id, status=None, recursive=False) to Cloud, with the same behaviour as the Server client:

  • sends DELETE /wiki/rest/api/content/{id} (with status when given), the same v1 endpoint delete_content() already uses;
  • with recursive=True, lists all children through get_page_child_by_type() before deleting any of them, then removes the page;
  • returns the status code (normally 204), or the raw response with advanced_mode=True;
  • maps 403/404/409 to ApiPermissionError/ApiError/ApiConflictError like Server does.

I also added a line to the remove_page entry in docs/confluence.rst saying it works on Cloud.

Tests: added five test_remove_page_* tests to tests/confluence/test_confluence_cloud.py (default call, status, recursive order, 403, and a call through Confluence(url="https://test.atlassian.net")); they 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.

docs/confluence.rst documents remove_page(page_id, status=None,
recursive=False), and the Server client has it, but the Cloud client
does not, so Confluence(url="https://<site>.atlassian.net") and
ConfluenceCloud raise "'Cloud' object has no attribute 'remove_page'".

Add remove_page to Cloud with the same arguments, return value and
error mapping as the Server client. It sends DELETE to
/wiki/rest/api/content/{id}, the endpoint delete_content already uses,
and with recursive=True lists all children before removing them.
@gonchik
gonchik merged commit a084440 into atlassian-api:master Oct 25, 2026
4 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