Forums

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

create a excerpt table through a rest api call

Erik Jansen August 23, 2021

We want to make a excerpt table on a confluence page through the api.

I tried this:

"Run results of " + getDate() + "<br /><ac:structured-macro ac:name=\"table-excerpt\" ac:schema-version=\"1\"  /><table>"

but this did not work. 

After the <table> part the content is built bij a json so i didn't put it in this example.

It works without the table excerpt but then we can't use it to make a dashboard out of it.

"Run results of " + getDate() + "<br /><table>"

1 answer

2 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.
August 23, 2021

Hello Erik,

You can create a page with the Table Excerpt macro and view the page storage format to find the correct markup. Here is an example with a table:

<ac:structured-macro ac:name="table-excerpt" ac:schema-version="1" ac:macro-id="4c63d950-0338-463a-af49-d1577785794b">
<ac:parameter ac:name="name">Example</ac:parameter>
<ac:rich-text-body> <table> <tbody> <tr> <th>A</th> <td>1</td></tr> <tr> <th>B</th> <td>2</td></tr> <tr> <th>C</th> <td>3</td></tr> <tr> <th>D</th> <td>4</td></tr></tbody>
</table> </ac:rich-text-body>
</ac:structured-macro>
Erik Jansen August 23, 2021

I have tried this but it didn't work

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.
August 23, 2021

Could you post the page storage that doesn't work here? Also, what error do you get?

Erik Jansen August 24, 2021

the error i get is just:

Page was not updated :( 500

I have tried putting this around the table:

<structured-macro name=\"table-excerpt\" schema-version=\"1\">
<parameter name=\"name\">Status</parameter>
<rich-text-body>

 

And this:

<ac:structured-macro ac:name="table-excerpt" ac:schema-version="1"><ac:parameter ac:name="name">status</ac:parameter><ac:rich-text-body><p class="auto-cursor-target"><br /></p><table><colgroup><col /><col /><col /><col /></colgroup><tbody>

 

And the closing tags after the table but both didn't work.

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.
August 24, 2021

Please, take a look at the stack trace of the error. There should be tips about what went wrong.

By the way, the first variant of the markup is not valid. Bu the second one looks fine.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events