@@ -720,6 +720,28 @@ def create_or_update_template(
720
720
721
721
return self .post ("wiki/rest/api/template" , json = data )
722
722
723
+ @deprecated (version = "3.7.0" , reason = "Use get_content_template()" )
724
+ def get_template_by_id (self , template_id ):
725
+ """
726
+ Get user template by id. Experimental API
727
+ Use case is get template body and create page from that
728
+ """
729
+ url = "rest/experimental/template/{template_id}" .format (template_id = template_id )
730
+
731
+ try :
732
+ response = self .get (url )
733
+ except HTTPError as e :
734
+ if e .response .status_code == 403 :
735
+ # Raise ApiError as the documented reason is ambiguous
736
+ raise ApiError (
737
+ "There is no content with the given id, "
738
+ "or the calling user does not have permission to view the content" ,
739
+ reason = e ,
740
+ )
741
+
742
+ raise
743
+ return response
744
+
723
745
def get_content_template (self , template_id ):
724
746
"""
725
747
Get a content template.
@@ -746,6 +768,40 @@ def get_content_template(self, template_id):
746
768
747
769
return response
748
770
771
+ @deprecated (version = "3.7.0" , reason = "Use get_blueprint_templates()" )
772
+ def get_all_blueprints_from_space (self , space , start = 0 , limit = None , expand = None ):
773
+ """
774
+ Get all users blue prints from space. Experimental API
775
+ :param space: Space Key
776
+ :param start: OPTIONAL: The start point of the collection to return. Default: None (0).
777
+ :param limit: OPTIONAL: The limit of the number of pages to return, this may be restricted by
778
+ fixed system limits. Default: 20
779
+ :param expand: OPTIONAL: expand e.g. body
780
+ """
781
+ url = "rest/experimental/template/blueprint"
782
+ params = {}
783
+ if space :
784
+ params ["spaceKey" ] = space
785
+ if start :
786
+ params ["start" ] = start
787
+ if limit :
788
+ params ["limit" ] = limit
789
+ if expand :
790
+ params ["expand" ] = expand
791
+
792
+ try :
793
+ response = self .get (url , params = params )
794
+ except HTTPError as e :
795
+ if e .response .status_code == 403 :
796
+ raise ApiPermissionError (
797
+ "The calling user does not have permission to view the content" ,
798
+ reason = e ,
799
+ )
800
+
801
+ raise
802
+
803
+ return response .get ("results" ) or []
804
+
749
805
def get_blueprint_templates (self , space = None , start = 0 , limit = None , expand = None ):
750
806
"""
751
807
Gets all templates provided by blueprints.
@@ -782,6 +838,41 @@ def get_blueprint_templates(self, space=None, start=0, limit=None, expand=None):
782
838
783
839
return response .get ("results" ) or []
784
840
841
+ @deprecated (since = "3.7.0" , reason = "Use get_content_templates()" )
842
+ def get_all_templates_from_space (self , space , start = 0 , limit = None , expand = None ):
843
+ """
844
+ Get all users templates from space. Experimental API
845
+ ref: https://docs.atlassian.com/atlassian-confluence/1000.73.0/com/atlassian/confluence/plugins/restapi\
846
+ /resources/TemplateResource.html
847
+ :param space: Space Key
848
+ :param start: OPTIONAL: The start point of the collection to return. Default: None (0).
849
+ :param limit: OPTIONAL: The limit of the number of pages to return, this may be restricted by
850
+ fixed system limits. Default: 20
851
+ :param expand: OPTIONAL: expand e.g. body
852
+ """
853
+ url = "rest/experimental/template/page"
854
+ params = {}
855
+ if space :
856
+ params ["spaceKey" ] = space
857
+ if start :
858
+ params ["start" ] = start
859
+ if limit :
860
+ params ["limit" ] = limit
861
+ if expand :
862
+ params ["expand" ] = expand
863
+
864
+ try :
865
+ response = self .get (url , params = params )
866
+ except HTTPError as e :
867
+ if e .response .status_code == 403 :
868
+ raise ApiPermissionError (
869
+ "The calling user does not have permission to view the content" ,
870
+ reason = e ,
871
+ )
872
+ raise
873
+
874
+ return response .get ("results" ) or []
875
+
785
876
def get_content_templates (self , space = None , start = 0 , limit = None , expand = None ):
786
877
"""
787
878
Get all content templates.
0 commit comments