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 ?
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.
You can get an example of updating a confluence page is this article.
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.
It looks like you're new here. Sign in or register to get started.