diff --git a/atlassian/confluence.py b/atlassian/confluence.py index 4c29cf978..f195ae2fd 100644 --- a/atlassian/confluence.py +++ b/atlassian/confluence.py @@ -2878,14 +2878,13 @@ def audit( return self.get(url, params=params) """ - ############################################################################################## - # Confluence whiteboards (cloud only!) # - ############################################################################################## - """ + ############################################################################################## + # Confluence whiteboards (cloud only!) # + ############################################################################################## + """ def create_whiteboard(self, spaceId, title=None, parentId=None): - # Use spaceId, not space key. - url = '/api/v2/whiteboards' + url = "/api/v2/whiteboards" data = {"spaceId": spaceId} if title is not None: data["title"] = title @@ -2895,26 +2894,27 @@ def create_whiteboard(self, spaceId, title=None, parentId=None): def get_whiteboard(self, whiteboard_id): try: - url = f'/api/v2/whiteboards/{whiteboard_id}' + url = f"/api/v2/whiteboards/{whiteboard_id}" return self.get(url) except HTTPError as e: # Default 404 error handling is ambiguous if e.response.status_code == 404: - raise ApiValueError("Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e) + raise ApiValueError( + "Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e + ) raise - def delete_whiteboard(self, whiteboard_id): - # Deleting a whiteboard moves the whiteboard to the trash, where it can be restored later try: - url = f'/api/v2/whiteboards/{whiteboard_id}' + url = f"/api/v2/whiteboards/{whiteboard_id}" return self.delete(url) except HTTPError as e: # # Default 404 error handling is ambiguous if e.response.status_code == 404: raise ApiValueError( - "Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e) + "Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e + ) raise diff --git a/docs/confluence.rst b/docs/confluence.rst index 4858a8f6e..3d375e5b7 100644 --- a/docs/confluence.rst +++ b/docs/confluence.rst @@ -161,6 +161,21 @@ Page actions # Get regex matches from Confluence page confluence.scrap_regex_from_page(page_id, regex) +Confluence Whiteboards +---------------------- + +.. code-block:: python + + # Create new whiteboard - cloud only + confluence.create_whiteboard(spaceId, title=None, parentId=None) + + # Delete existing whiteboard - cloud only + confluence.delete_whiteboard(whiteboard_id) + + # Get whiteboard by id - cloud only! + confluence.get_whiteboard(whiteboard_id) + + Template actions ---------------- diff --git a/examples/confluence/confluence_whiteboard.py b/examples/confluence/confluence_whiteboard.py new file mode 100644 index 000000000..71695a707 --- /dev/null +++ b/examples/confluence/confluence_whiteboard.py @@ -0,0 +1,20 @@ +from atlassian import Confluence + +confluence = Confluence( + url="", + username="", + password="api_key", +) +""" +This is example on how to use confluence whiteboard endponds +Currently only available on confluence cloud +""" +# create whiteboard. First parameter is a spaceID (not spacekey!), +# second param is a name of whiteboard (optional), third one is a parent pageid (optional) +confluence.create_whiteboard("42342", "My whiteboard", "545463") + +# To delete of get whiteboard, use whiteboard id +# https:///wiki/spaces//whiteboard/ +# Deleting a whiteboard moves the whiteboard to the trash, where it can be restored later +confluence.delete_whiteboard("42342") +confluence.get_whiteboard("42342")