Hello all,
I've recently switched from the SOAP api to the rest API to create and update confluence pages (I'm using Confluence 5.5.6).
I would like to report a strange behaviour with the API when updating a page.
First, it's important to know that if you use the example from the Rest API example page ( https://developer.atlassian.com/display/CONFDEV/Confluence+REST+API+Examples ), your page will loose its ancestor. The page ancestor is deleted and the page ancestor is its space: you cannot browse it with the treeview. In order to avoid that problem, you have to provide the ancestor in the request.
Second, to update a JIRA issue or a confluence page with the REST API, I send a request with all the elements needed to update the issue or the page, I modify the JSON received and I send it back (it seems to be pretty obvious behaviour).
So in order to update a confluence page the minimal request has this form: http://<host>:8080/confluence/rest/api/content/<id>?expand=body.storage,version,ancestors
body.storage and version are updated in the JSON and a PUT request is sent back.
Unfortunately, if you do so, your page will still loose its ancestor... And it took me a while to figure out why: the returned JSON has ALL the ancestors of the page: the direct ancestor of the page, the ancestor of the ancestor and so on until the space root. So the array has several ancestors... And if you don't remove them except the direct ancestor, your page will loose its ancestor.
So I wonder, anyone else came accross that problem ? Is it a normal behaviour or a bug/feature ?
Any opinions welcome.
Fabio