Skip to content

Commit 15593e5

Browse files
authored
Merge pull request #79 from AdityaMisra/master
Method to get the page_id if we have the title of the pge, parent page id and space name
2 parents 80d1a51 + d4a2c95 commit 15593e5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

atlassian/confluence.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,3 +563,24 @@ def cql(self, cql, start=0, limit=None):
563563
if cql is not None:
564564
params['cql'] = cql
565565
return self.get('rest/api/search', params=params)
566+
567+
def get_descendant_page_id(self, space, parent_id, title):
568+
"""
569+
Provide space, parent_id and title of the descendant page, it will return the descendant page_id
570+
:param space: str
571+
:param parent_id: int
572+
:param title: str
573+
:return: page_id of the page whose title is passed in argument
574+
"""
575+
page_id = ""
576+
577+
url = 'rest/api/content/search?cql=parent={}%20AND%20space="{}"'.format(
578+
parent_id, space
579+
)
580+
response = self.get(url, {})
581+
582+
for each_page in response.get("results", []):
583+
if each_page.get("title") == title:
584+
page_id = each_page.get("id")
585+
break
586+
return page_id

0 commit comments

Comments
 (0)