Moving pages through API - update page tree, re-position the page?
Asked by Marcin Adamski:

Hi,

I have a question regarding moving pages using the REST API. I've been able to do it using the update-content method, but it seems like it's not exactly perfect.

![confluence.png](/t5/image/serverpage/image-id/64943i82C349AE1C928E3D/image-size/large?v=v2&px=999 "confluence.png")

As you can see on the picture, the page says it's moved, but visually it stays in the same place it was originally created. Do you have any ideas as to how to overcome this? I've seen the pages update and show up in the correct place at some times, but I'm not sure whether it's a matter of time, or just updating the page tree in a different way (ie. adding new page, as this seems to update it) and would like to make it happen instantly, or at least to be able to force it through the API as well (couldn't find anything in the documentation, although it's not the best to be honest...).

Also additional question - is there a way to change how pages are sorted under a specific parent? Or are pages always added at the end? Because in some cases we would need the page to be on the top. If it's not configurable then how to move it via API? Because currently the page is created via third party, and the most I could do is move it, but I can't really comprehend how, there is the:  
"extensions": {  
"position": "none"  
}

node which I thought would do it, but I can't get it to work.

To be clear - I will be calling the API via PowerShell, have some scripts prepared already and hope I'll be able to finish what's required :)


Answers:
author: Diego
body: Hey there, Marcin!  
I may not be the perfect match for your request, however, I have found this thread in our Community. A pretty recent thread, for that matter:
> * [++***Move page to new parent with Confluence Cloud REST API***++](https://community.atlassian.com/t5/Confluence-questions/Move-page-to-new-parent-with-Confluence-Cloud-REST-API/qaq-p/1014106)

Maybe you can compare your API calls with the ones presented in the thread and check if there is anything worth improving.

To address your second question. Yes, we can reorder pages in Confluence Cloud. There is also a thread about our recent change applied to page order. You can have a peek here, Marcin:
> * ++***[Update to default sort order for newly created pages Edited](https://community.atlassian.com/t5/Confluence-discussions/Update-to-default-sort-order-for-newly-created-pages/m-p/955068#M3298)***++

However, there is *++no method to reorder pages via the REST API++*. You can check a reported Feature Request about it here:
> * ++***[CONFCLOUD-40101 \| Allow changing page order via REST](https://jira.atlassian.com/browse/CONFCLOUD-40101)***++

Hope this helps you out, Marcin! Looking forward to your reply.

comments: author: Marcin Adamski
body: Hi Diego,

Thanks for the response, I saw the first question originally, but thought this could be resolved in a different way and I wouldn't have to use a workaround, but I guess this will be fine for now.

As for the order of the pages however - is this change of yours already taken back? Because every page created on our confluence ends up at the bottom, and I don't see an option to change it, I only can make it alphabetical where it was modified manually, it would be great if there were options to set for example - create all pages under this parent at the top, but do it alphabetically otherwise, because it's not always needed to be the same way.  

I hope there will come an option to change it via REST API, or configuration that will handle it, so we wouldn't need to do it manually.

I'll accept your answer since it seems the workaround is the only way currently, and there's no way to re-order via API currently so not expecting anyone to answer differently :D


author: Supreet
body: [@Marcin Adamski](/t5/user/viewprofilepage/user-id/1303633) This has been due to new drag and drop and I have already reported below bug for the same: <https://jira.atlassian.com/browse/CONFCLOUD-67046>


author: Craig Anderson
body: There is an API call which should do everything you want: [Move position](https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content---children-and-descendants/#api-wiki-rest-api-content-pageid-move-position-targetid-put)


Tags: cloud

confluence-cloud