Forums

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

updating chart in confluence through the API

akumars
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!
May 8, 2017

I am trying to update the wiki page with a  chart macro, but does not seem to be updating properly

Getting 200 OK response. But the page looks like this, no chart renderedchart.jpg

Response back has this 

 

{code}

{"storage":{"value":"<table class=\\"wysiwyg-macro\\" style=\\"background-image: url(/wiki/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NoYXJ0Om9yaWVudGF0aW9uPXZlcnRpY2FsfHN0YWNrZWQ9dHJ1ZXxmb3JnaXZlPWZhbHNlfGRhdGFPcmllbnRhdGlvbj12ZXJ0aWNhbHx0eXBlPWJhcnx5TGFiZWw9Y291bnR8eExhYmVsPW5hbWV9&amp;locale=en_GB&amp;version=2);background-repeat: no-repeat;\\"> <tbody> <tr> <td class=\\"wysiwyg-macro-body\\"> <p class=\\"auto-cursor-target\\"> <br /> </p> <table class=\\"confluenceTable wrapped\\"> <tbody> <tr> <th class=\\"confluenceTh\\">col</th> <th class=\\"confluenceTh\\">test2</th> <th colspan=\\"1\\" class=\\"confluenceTh\\">test3</th> </tr> <tr> <td class=\\"confluenceTd\\">1</td> <td class=\\"confluenceTd\\">400</td> <td colspan=\\"1\\" class=\\"confluenceTd\\">6000</td> </tr> <tr> <td class=\\"confluenceTd\\">2</td> <td class=\\"confluenceTd\\">5000</td> <td colspan=\\"1\\" class=\\"confluenceTd\\">3000</td> </tr> <tr> <td class=\\"confluenceTd\\">3</td> <td class=\\"confluenceTd\\">6</td> <td colspan=\\"1\\" class=\\"confluenceTd\\">7000</td> </tr> </tbody> </table> <p class=\\"auto-cursor-target\\"> <br /> </p> </td> </tr> </tbody> </table>","representation":"storage","embeddedContent":[],"_expandable":{"content":"/rest/api/content/156246922"}}

{code}

2 answers

0 votes
dasAnderl
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!
January 18, 2018

im trying to do the same thing. make an api call to upload data which is then displayed as a chart. @akumars @Andrey Khaneev _StiltSoft_ could please provide more information/code how to do this?

Andrey Khaneev _StiltSoft_
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.
January 18, 2018

Hello,

Please, take a look at this REST API. With this API you cant set new content of the page. So you need to have page storage format for this purpose. I suppose, chart macro settings will be the same for all you calls while a table with data can change. Then you can create a page with configured chart macro and a dummy table data, copy page storage format and modify its table each time you update the page.

0 votes
Andrey Khaneev _StiltSoft_
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.
May 10, 2017

Hello,

As I see you update the page with the page editor format, but it requires page storage format. You can find page storage format in Page Tools (three dots) -> View Storage Format.

Also I can suggest you to move the source table to another page. It is easier to update page with just a table. And on a page with the Chart macro use Page Include macro that will point on the page with the table you update.

akumars
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!
May 10, 2017

Thanks Andrey, i finally figured that out yesterday. I will try out your suggestion for separating the table. Thank you

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events