Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,297,597
Community Members
 
Community Events
165
Community Groups

Rest API - how to insert children display micro while creation of page

Hello,

I am using confluence rest api and python module requests to create multiple pages in confluence. 

I will have parent and child hierarchy of pages. I want to insert children display macro at parent page using rest api call. 

code sample: 

invpagebodyhtml = "<p><b>This page is published by automation tool.</b></p>"
create_page = json.dumps(    {        "type""page",        "title""testing-notification",        "space": {"key""TEST"},        "ancestors": [{"id"1234567}],        "status""current",        "body": {"storage": {"value": invpagebodyhtml, "representation""storage",}},    })

response = requests.request(    "POST", URL, data=create_page, headers=headers,)

any help on how to include that macro here? 

Thanks

Sukh

1 answer

1 accepted

0 votes
Answer accepted

I got it worked with adding this to my html 

 

old html: 

invpagebodyhtml  = '<p><b>This page is published by automation tool.</b></p>'

 

new html:

invpagebodyhtml  = '<p><b>This page is published by automation tool.</b></p><p><ac:structured-macro ac:name=\"children\" ac:schema-version=\"1\" /></p>'

Great, many thanks for the answer. Eventually, you don't know how to add the 'Depth' parameter into this syntax ?

I had to trial and error this, but I just figured out how to do this, this is an example for the 'all'/descendants property:

 

<p><ac:structured-macro ac:name=\"children\" ac:schema-version=\"1\"><ac:parameter ac:name=\"all\">true</ac:parameter></ac:structured-macro></p>

It took me forever to find the docs: https://confluence.atlassian.com/conf59/children-display-macro-792499081.html

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

71 views 0 0
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you