The curl call im using is this one:
curl --location --request PUT http://localhost.com:8090/rest/api/content/21169510 --header "Accept: application/json" --header "Content-Type: application/json" --user user:password --data "{\"id\": \"21169510\",\"type\": \"page\",\"title\": \"Test Doors\",\"space\": {\"key\": \"TOOL\"},\"body\": {\"storage\": {\"value\": \" <p class=\"auto-cursor-target\"><br /></p><table><colgroup><col /><col /><col /></colgroup><tbody><tr><th>KPI</th><th>KPI</th><th>KPI</th></tr><tr><td>1</td><td>1</td><td>1</td></tr><tr><td>1</td><td>1</td><td>1</td></tr></tbody></table><p class=\"auto-cursor-target\"><br /></p> \",\"representation\": \"storage\"}},\"version\": {\"number\": \"13\"}}"
Im getting problems when updating the content of a page with something more complex than a simple sentence (in this case it works perfectly). If i dont use the \" with the body-storage-value, it gets an error with the < character, and if i use it, it answers with 500 internal server error. in this case i was trying to create a table.
Does anybody know what am I doing wrong?
Dear @[deleted] ,
I know this kind of problems - made the same xp in the past. In most cases its a problem with encoding / escaping special chars.
I recommend to use first a browser extension for posting REST calls. There you can step by step debug you JSON payload.
Then I also recommend to call curl from a script. Python or PHP are pretty fine. They have both functions to encode the data to UTF-8.
So long
Thomas
Thank you for your answer. Using Postman I am able to do it, but i need to use the curl commands so i can automate it later. Its just matter of knowing how do i need to introduce the data for the body content, and how do i need to put the \" characters. I am able to do it creating a Json from the command line and adding in there the variables but that is significantly more difficult. So if anyone knows how to solve my doubt it would be great.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.