How use HTML macro through curl

Alok Singh March 30, 2018

Hi,

I am trying to update confluence page through curl command, but facing below issue.

Please assist me else let me know how to update html iframe tag using curl command.

Thanks

Code:
curl -u user:passwd -X PUT -H 'Content-Type: application/json' -d'{"body": {"storage": {"representation": "storage", "value": "<ac:structured-macro ac:name=\"html\" ac:schema-version=\"1\" ac:macro-id=\"9b345ba9-a013-4984-9eb3-d4c3f89d3986\"><ac:plain-text-body><iframe width=\"100%\" height=\"225px\" style=\"border: none\" src=https://test.in:28185/CR/CR1777871></iframe></ac:plain-text-body></ac:structured-macro><ac:structured-macro ac:name=\"html\" ac:schema-version=\"1\" ac:macro-id=\"95a008e2-1831-4405-8a32-73ddffa89495\"><ac:plain-text-body><iframe width=\"100%\" height=\"225px\" style=\"border: none\" src=https://test.in:28185/CR/CR1777870></iframe></ac:plain-text-body></ac:structured-macro>"}},"space": {"key": "KEY_NAME"}, "title": "TEST1", "version": {"number": 8}, "type": "page", "id":"168016254"}' https://confluence.in/rest/api/content/168016254

Error:

{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"Error parsing xhtml: Unexpected character 'h' (code 104) in start tag Expected a quote\n at [row,col {unknown-source}]: [1,511]"}

 

1 answer

0 votes
Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

@Alok Singh Has you tried to update the above bodyContent via an external json file? I guess your above json having some invalid format.

Try it with a json file and you don't need to escape it like the direct json string for curl

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events