Repository navigation
Confluence Cloud: add and delete labels through the v1 endpoint - #1693
Open
R3gardless wants to merge 2 commits into
Open
R3gardless wants to merge 2 commits into
R3gardless wants to merge 2 commits into
Conversation
The Confluence Cloud v2 API only defines GET for /pages/{id}/labels, so
add_page_label(), add_page_labels() and delete_page_label() were sending
POST/DELETE to an endpoint that does not accept them.
Route those three writes to the v1 endpoint rest/api/content/{id}/label,
which is still available on Cloud, and send the payload shape it expects
([{"prefix": "global", "name": ...}]). Reading labels stays on v2.
This branch has not been deployed
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.
Problem
ConfluenceCloud.add_page_label(),add_page_labels()anddelete_page_label()sendPOST/DELETEtoapi/v2/pages/{id}/labels.The Confluence Cloud v2 API only defines GET for every label path. From Atlassian's own v2 OpenAPI spec (
https://dac-static.atlassian.com/cloud/confluence/openapi-v2.v3.json,info.version2.0.0):There is no label write endpoint in v2 at all, so these three methods cannot work against Cloud today.
Change
page_labels_writeentry toConfluenceEndpoints.V2pointing at the v1 pathrest/api/content/{id}/label, which is still served on Cloud.add_page_label(),add_page_labels()anddelete_page_label(), and send the payload shape v1 expects:[{"prefix": "global", "name": "<label>"}].get_page_labels(),get_space_labels()) is unchanged and stays on v2.results).Tests
tests/test_confluence_v2.py:test_add_page_label,test_add_page_labels,test_delete_page_labelnow assert the v1 endpoint and payload.tests/test_confluence_v2_with_mocks.py:test_add_page_labelmocks the v1 endpoint.1751 passed, 10 skipped.