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

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

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

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
AUG Leaders

Atlassian Community Events