@@ -1512,6 +1512,43 @@ def get_space(self, space_key, expand='description.plain,homepage'):
15121512 raise
15131513 return response
15141514
1515+ def get_space_content (self , space_key , depth = "all" , start = 0 , limit = 500 , content_type = None , expand = "body.storage" ):
1516+ """
1517+ Get space content.
1518+ You can specify which type of content want to recieve, or get all content types.
1519+ Use expand to get specific content properties or page
1520+ :param space_key: The unique space key name
1521+ :param depth: OPTIONAL: all|root
1522+ Gets all space pages or only root pages
1523+ :param start: OPTIONAL: The start point of the collection to return. Default: 0.
1524+ :param limit: OPTIONAL: The limit of the number of pages to return, this may be restricted by
1525+ fixed system limits. Default: 500
1526+ :param expand: OPTIONAL: by default expands page body in confluence storage format.
1527+ See atlassian documentation for more information.
1528+ :return: Returns the space along with its ID
1529+ """
1530+
1531+ content_type = "{}" .format ("/" + content_type if content_type else "" )
1532+ url = 'rest/api/space/{space_key}/content{content_type}' .format (space_key = space_key , content_type = content_type )
1533+ params = {
1534+ "depth" : depth ,
1535+ "start" : start ,
1536+ "limit" : limit ,
1537+ }
1538+ if expand :
1539+ params ["expand" ] = expand
1540+ try :
1541+ response = self .get (url , params = params )
1542+ except HTTPError as e :
1543+ if e .response .status_code == 404 :
1544+ # Raise ApiError as the documented reason is ambiguous
1545+ raise ApiError (
1546+ "There is no space with the given key, "
1547+ "or the calling user does not have permission to view the space" ,
1548+ reason = e )
1549+ raise
1550+ return response
1551+
15151552 def get_home_page_of_space (self , space_key ):
15161553 """
15171554 Get information about a space through space key
0 commit comments