Skip to content

Commit fd3c1b6

Browse files
author
gkowalc
committed
added confluence whiteboard endpoints
1 parent 8233f84 commit fd3c1b6

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

atlassian/confluence.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,14 +2878,13 @@ def audit(
28782878
return self.get(url, params=params)
28792879

28802880
"""
2881-
##############################################################################################
2882-
# Confluence whiteboards (cloud only!) #
2883-
##############################################################################################
2884-
"""
2881+
##############################################################################################
2882+
# Confluence whiteboards (cloud only!) #
2883+
##############################################################################################
2884+
"""
28852885

28862886
def create_whiteboard(self, spaceId, title=None, parentId=None):
2887-
# Use spaceId, not space key.
2888-
url = '/api/v2/whiteboards'
2887+
url = "/api/v2/whiteboards"
28892888
data = {"spaceId": spaceId}
28902889
if title is not None:
28912890
data["title"] = title
@@ -2895,26 +2894,27 @@ def create_whiteboard(self, spaceId, title=None, parentId=None):
28952894

28962895
def get_whiteboard(self, whiteboard_id):
28972896
try:
2898-
url = f'/api/v2/whiteboards/{whiteboard_id}'
2897+
url = f"/api/v2/whiteboards/{whiteboard_id}"
28992898
return self.get(url)
29002899
except HTTPError as e:
29012900
# Default 404 error handling is ambiguous
29022901
if e.response.status_code == 404:
2903-
raise ApiValueError("Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e)
2902+
raise ApiValueError(
2903+
"Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e
2904+
)
29042905

29052906
raise
29062907

2907-
29082908
def delete_whiteboard(self, whiteboard_id):
2909-
# Deleting a whiteboard moves the whiteboard to the trash, where it can be restored later
29102909
try:
2911-
url = f'/api/v2/whiteboards/{whiteboard_id}'
2910+
url = f"/api/v2/whiteboards/{whiteboard_id}"
29122911
return self.delete(url)
29132912
except HTTPError as e:
29142913
# # Default 404 error handling is ambiguous
29152914
if e.response.status_code == 404:
29162915
raise ApiValueError(
2917-
"Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e)
2916+
"Whiteboard not found. Check confluence instance url and/or if whiteboard id exists", reason=e
2917+
)
29182918

29192919
raise
29202920

docs/confluence.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,21 @@ Page actions
161161
# Get regex matches from Confluence page
162162
confluence.scrap_regex_from_page(page_id, regex)
163163
164+
Confluence Whiteboards
165+
----------------------
166+
167+
.. code-block:: python
168+
169+
# Create new whiteboard - cloud only
170+
confluence.create_whiteboard(spaceId, title=None, parentId=None)
171+
172+
# Delete existing whiteboard - cloud only
173+
confluence.delete_whiteboard(whiteboard_id)
174+
175+
# Get whiteboard by id - cloud only!
176+
confluence.get_whiteboard(whiteboard_id)
177+
178+
164179
Template actions
165180
----------------
166181

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from atlassian import Confluence
2+
3+
confluence = Confluence(
4+
url="<instance_url>",
5+
username="<atlassian_username>",
6+
password="api_key",
7+
)
8+
"""
9+
This is example on how to use confluence whiteboard endponds
10+
Currently only available on confluence cloud
11+
"""
12+
# create whiteboard. First parameter is a spaceID (not spacekey!),
13+
# second param is a name of whiteboard (optional), third one is a parent pageid (optional)
14+
confluence.create_whiteboard("42342", "My whiteboard", "545463")
15+
16+
# To delete of get whiteboard, use whiteboard id
17+
# https://<instance_name>/wiki/spaces/<space_key>/whiteboard/<whiteboard_id>
18+
# Deleting a whiteboard moves the whiteboard to the trash, where it can be restored later
19+
confluence.delete_whiteboard("42342")
20+
confluence.get_whiteboard("42342")

0 commit comments

Comments
 (0)