Forums

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

How to use REST API to add an Expand Macro on my page?

Huangyingrui Wang
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!
August 15, 2023

My team currently using this curl to update some wiki report page through api. Where the dynamicRequest.txt contains some html body.

curl, --header, Accept-Language:en-us, --header, Accept: */*, --header, Content-Type:application/json, -b, ./files/sse_wiki_cookie.txt, -X, PUT, https://ssewiki.apple.com/rest/api/content/[pageId], -d, @./files/ssewiki1692039010943_dynamicRequest.txt

We want to add an expand Macro to store some data in one cell of the table.

I simply copy the expand Macro structure from the page inspect itself, But It is not working. I think the js script does not link to my container. Please share any ideas. Thank you

1 answer

1 accepted

1 vote
Answer accepted
Andrii Maliuta
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 15, 2023

Hello @Huangyingrui Wang ,

If you set the new data in 

sse_wiki_cookie.txt

so you can get the page body first and then append data to it or erase current body with the data.

The storage format would be:

<ac:structured-macro ac:name="expand" ac:schema-version="1" ac:macro-id="id">
<ac:rich-text-body> {YOUR DATA HERE}
</ac:rich-text-body>
</ac:structured-macro>

 So you just wrap the content inside such code. It can have also some additional attributes, but this one is the simple option.

Huangyingrui Wang
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!
August 16, 2023

Hello, @Andrii Maliuta 
Thanks for your Reply.
It works perfectly.

Only one problem, I guess it is a typo.
Should put New HTML Data into ssewiki_dynamicRequest.txt
sse_wiki_cookie.txt is for Auth_token

Like Andrii Maliuta likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events