I am trying to use the new REST API v2, since v1 is now deprecated, but I have some major issues with it…
The version comment does not get applied
All Macros with a plain-text-body get the body removed (possibly with rich-text-body too but I have not tested this yet), THIS IS REALLY BAD.
It doesn’t seem to support the old editor format, it complains about malformed XML, which is basically the same storage it served me in the get page request?
Has anyone had success updating a page with Macros (old and new editor formats) using REST v2?
I will share code if someone can help.
I found the issue, had to do with js XMLParser, it replaced the markers around the
CDATA block with HTML comments, so this
<![CDATA[.....]]>, was returned by the parser as
<!--[CDATA[...]]-->, so yeah, once I manually fix this, it all worked as expected.
March 21, 2023, 12:42am
Thank you very much
@mr.chris.kent for sharing the solution.
I was looking into this as well and could successful update a page content containing the Expand Macro using the
v2 REST APIs.
I’ll just share the payload here in case it might help others testing this in the future:
"value":"<p>Body</p><ac:structured-macro ac:name=\"toc\" ac:schema-version=\"1\" data-layout=\"default\" ac:local-id=\"addc96e9-17e1-40df-909a-1dd30a67f4ec\" ac:macro-id=\"f59bca94-312e-4e69-a404-d5eb50f54ffd\" /><p /><ac:structured-macro ac:name=\"expand\" ac:schema-version=\"1\" ac:macro-id=\"62b38ac6-91f2-4dd8-b582-0a20d7119299\"><ac:parameter ac:name=\"title\">Test</ac:parameter><ac:rich-text-body><p>Macro</p></ac:rich-text-body></ac:structured-macro><p />",
The body storage was retrieved using the
/wiki/api/v2/pages/<pageId>?body-format=storage endpoint, which is documented
For the version comment not being applied, I’ve raised a bug with the team:
[CONFCLOUD-75534] Updating a page with the Confluence Rest API v2 fails when providing the version message - Create and track feature requests for Atlassian products.