How to insert a pie chart with wiki markup in page content parameter using Confluence Command Line Interface (CLI)

This article explains how to insert a pie chart using Wiki Markup through Confluence Command Line Interface (CLI).

Instructions

  1. Create a new page using addPage action and add the wiki markup as content on the page using --content parameter.

  2. Refer to the CLI action given below, where the chart macro is added within the page.

    --action addPage --space "~admin" --title "mypagetitle-1" --content "<ac:structured-macro ac:name='chart'><ac:parameter ac:name='title'>Fish Sold</ac:parameter><ac:rich-text-body><table class='wrapped'><colgroup><col/><col/><col/></colgroup><tbody><tr><th><span>Fish Type</span></th><th><span>2004</span></th><th><span>2005</span></th></tr><tr><td><span>Herring</span></td><td><span>9,500</span></td><td>8,300</td></tr></tbody></table></ac:rich-text-body></ac:structured-macro>" --noConvert


  3. Modify an existing page using modifyPage action and add the following wiki markup content on the page:

    --action modifyPage --space "~admin" --title "mypagetitle" --content "<ac:structured-macro ac:name='chart'><ac:parameter ac:name='title'>Fish Sold</ac:parameter><ac:rich-text-body><table class='wrapped'><colgroup><col/><col/><col/></colgroup><tbody><tr><th><span>Fish Type</span></th><th><span>2004</span></th><th><span>2005</span></th></tr><tr><td><span>Herring</span></td><td><span>9,500</span></td><td>8,300</td></tr></tbody></table></ac:rich-text-body></ac:structured-macro>" --noConvert

    The parameter noConvert helps to display the output in the wiki format. If not mentioned, the output is displayed as a storage format.

If you want to modify any other data inside the page, make changes in the content parameter of the action command accordingly.

It is recommended to test this scenario in a non-production environment, or, run the action with the --simulate parameter to verify the behavior before deploying.