I am writing a script to update a confluence page through the REST API, using:
curl -u user:password -X PUT -H 'Content-Type: application/json' -d'{"id":173390846,"type":"page","title":"test4","body":{"storage":{"value":"hello world","representation":"storage"}},"version":{"number":10}}' http://confluence.private.com/rest/api/content/173390846
but sometimes i get the following error.
{"statusCode":500,"message":"java.lang.IllegalArgumentException: Property with name sync-rev is not a String"}
This can happen if I manually edited and saved the page, or it can happen without the page having been edited manually.
Sometimes if I run the update again it works, and some times it persists and gives the same error.
The script im writing is bigger than the hello world example, but If I created a new blank page, updated it through the REST API, edited it manually, and attempted to update it again (with version incremented) I got the abovementioned error.
I have not found any mention of the property sync-rev other than in this doc, but it has not helped me in solving my problem.
Our confluence version is 5.9.6
Why am I getting this error, and what can i do/change so that it goes away?
I've got the same problem and asked for help in the atlassian community. You can follow my question at https://answers.atlassian.com/questions/38379050/how-to-update-confluence-pages-using-rest-api
Further I contacted the support as it seems to me that this problem is a bug at confluence. I will keep you updated with the supports response.
Edit: This is what Atlassian suggests:
- backup the database since this require manual database delete
- run the following SQL query:
// identify how many entries need to be deleted
select count( distinct propertyid) from CONTENTPROPERTIES where propertyname='sync-rev';
// delete all of the entries delete from CONTENTPROPERTIES where propertyname='sync-rev';- restart Confluence instance
- verify if the problem persist
Please note that I have not verified their solution yet.