@@ -137,8 +137,8 @@ def get_parent_content_id(self, page_id):
137137 parent_content_id = None
138138 try :
139139 parent_content_id = (
140- (self .get_page_by_id (page_id = page_id , expand = 'ancestors' ).get ('ancestors' ) or {})[- 1 ].get (
141- 'id' ) or None )
140+ (self .get_page_by_id (page_id = page_id , expand = 'ancestors' ).get ('ancestors' ) or {})[- 1 ].get (
141+ 'id' ) or None )
142142 except Exception as e :
143143 log .error (e )
144144 return parent_content_id
@@ -152,8 +152,8 @@ def get_parent_content_title(self, page_id):
152152 parent_content_title = None
153153 try :
154154 parent_content_title = (
155- (self .get_page_by_id (page_id = page_id , expand = 'ancestors' ).get ('ancestors' ) or {})[- 1 ].get (
156- 'title' ) or None )
155+ (self .get_page_by_id (page_id = page_id , expand = 'ancestors' ).get ('ancestors' ) or {})[- 1 ].get (
156+ 'title' ) or None )
157157 except Exception as e :
158158 log .error (e )
159159 return parent_content_title
@@ -653,10 +653,43 @@ def get_template_by_id(self, template_id):
653653
654654 return response
655655
656+ def get_all_blueprints_from_space (self , space , start = 0 , limit = 20 , expand = None ):
657+ """
658+ Get all users blue prints from space. Experimental API
659+ :param space: Space Key
660+ :param start: OPTIONAL: The start point of the collection to return. Default: None (0).
661+ :param limit: OPTIONAL: The limit of the number of pages to return, this may be restricted by
662+ fixed system limits. Default: 20
663+ :param expand: OPTIONAL: expand e.g. body
664+
665+ """
666+ url = 'rest/experimental/template/blueprint'
667+ params = {}
668+ if space :
669+ params ['spaceKey' ] = space
670+ if start :
671+ params ['start' ] = start
672+ if limit :
673+ params ['limit' ] = limit
674+ if expand :
675+ params ['expand' ] = expand
676+
677+ try :
678+ response = self .get (url , params = params )
679+ except HTTPError as e :
680+ if e .response .status_code == 403 :
681+ raise ApiPermissionError (
682+ "The calling user does not have permission to view the content" ,
683+ reason = e )
684+
685+ raise
686+
687+ return response .get ('results' ) or []
688+
656689 def get_all_templates_from_space (self , space , start = 0 , limit = 20 , expand = None ):
657690 """
658- https://docs.atlassian.com/atlassian-confluence/1000.73.0/com/atlassian/confluence/plugins/restapi/resources/TemplateResource.html
659691 Get all users templates from space. Experimental API
692+ ref: https://docs.atlassian.com/atlassian-confluence/1000.73.0/com/atlassian/confluence/plugins/restapi/resources/TemplateResource.html
660693 :param space: Space Key
661694 :param start: OPTIONAL: The start point of the collection to return. Default: None (0).
662695 :param limit: OPTIONAL: The limit of the number of pages to return, this may be restricted by
@@ -685,8 +718,7 @@ def get_all_templates_from_space(self, space, start=0, limit=20, expand=None):
685718
686719 raise
687720
688- return response .get ('results' )
689-
721+ return response .get ('results' ) or []
690722
691723 def get_all_spaces (self , start = 0 , limit = 500 , expand = None ):
692724 """
0 commit comments