I am using the following simple curl call to create a new Confluence page with an embedded IFrame macro that references an external site:
curl -u <username>:<password> -X POST -H 'Content-Type: application/json' -d '{"type":"page","title":"A Test Page", "space":{"key":"SPACE"}, "ancestors" : [ { "id": "115328548" } ],"body":{"storage":{"value":"<h1>IFrame Macro Test</h1><p>Foo Bar Blah</p><p><ac:structured-macro ac:schema-version=\"1\" ac:name=\"iframe\"><ac:parameter ac:name=\"URL\">https://www.example.com</ac:parameter><ac:parameter ac:name=\"Width\">100%</ac:parameter><ac:default-parameter>https://www.example.com</ac:default-parameter></ac:structured-macro></p>","representation":"storage"}}}' https://localhost:8080/confluence/rest/api/content | python -mjson.tool;
Whilst the page is being created with the embedded macro none of the macro parameters have been set, per the definitions in the request payload. "URL" is a mandatory parameter for the macro, however I am unclear if the element should be used, or alternatively the element (and hence set both - to no avail).
Thanks and regards, Andrew
The Confluence XHTML content payload needs to be as follows:
The easiest way to determine the correct payload is to manually create the page with macro and use the REST API to retrieve the XHTML content fragment