Hi I am extremely new to confluence and was trying to use the REST APIs with cURL.
I have been digging around and I never found a clear answer.
From the examples url I was able to do the update with no issues.
https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/
However it seems to overwrite all of the previous entries.
I did find a few posts about doing a expand=body.storage into a variable but it seems to fail with a 500 internal server error. I noticed that if I do something simple without spaces or other characters it works fine.
examples of what I'm doing:
export oldcontent=`curl -u $mypass -X GET "https://myconfluence.example.com:8443/rest/api/content/1234567?expand=body.storage"`
note something like this works fine.
export simplevar=onewordsimplevar
Then I try to an update with the variable.
curl -v -S -u $mypass -X PUT -H 'Content-Type: application/json' --data '{"id":"1234567","type":"page","title":"test","space":{"key":"TST"},"body":{"storage":{"value":" '$oldcontent' <p>This is an updated test from REST API 2</p>","representation":"storage"}},"version":{"number":29}}' https://myconfluence.example.com:8443/rest/api/content/1234567
In the verbose it has errors like its trying to interpret the content
* Could not resolve host: My oldcontent here
* Closing connection 4
* Could not resolve host: REST; Unknown error
curl: (3) [globbing] unmatched close brace/bracket at pos 88
{"statusCode":500,"message":"","reason":"Internal Server Error"}
Any advice? Is there an article with examples how to append to pages?
Thanks