Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

create a page in html from the REST API with Table of Contents macro

William.Brennion
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 31, 2019

I would like to import some page from html to confluence, this work well with the REST API 

{"type":"page","title":"test3",
"space":{"key":"DM"},"body":{"storage":{"value":"<somehtml>"

 

But how could I add on top of that a Table of Contents macro ?

3 answers

0 votes
Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2019 edited

I'd also recommend using this python module: atlassian-python-api (https://github.com/atlassian-api/atlassian-python-api)

Following example (https://github.com/atlassian-api/atlassian-python-api/blob/master/examples/confluence-page-update.py) demostrates updating of the page by using the specified API. I am citing the sample here:

You can check the implemenation of update_page method here (https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/confluence.py).

Hope this helps. Would be nice to hear back if it helped.

0 votes
Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2019 edited

You can get an example of updating a confluence page is this article.

0 votes
Stan Ry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2019 edited

Hi @William.Brennion

You'd have to contatenate content of your destination page and HTML table layout that you are about to add. When using PUT method on https://example.net/confluence_instance/plugins/servlet/restbrowser#/resource/api-content-id-label API, the target page specified in contentId is overwritten by the content you place in request body.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, loom, loom for training, loom for teaching, video training, async learning, online education, screen recording, loom tutorials, loom use cases, atlassian learning, team training tools, instructional video, virtual training tools

🛗 Elevate Your Training and Enablement with Loom

Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!

Register today
AUG Leaders

Atlassian Community Events