Search code examples
restapiconfluenceconfluence-rest-api

How to create new page as first child of a specific parent in Confluence using their REST API?


It is quite simple to automatically create a new page in confluence by using the REST API (How to create new page in Confluence using their REST API?).

However this adds the newly generated site to the bottom of the page hierarchy/Page navigation, like so:

+ Reports
    + Report for January
    + Report for February
    + Report for MARCH
    + NEWLY ADDED REPORT for APRIL

Still, it would be preferable to have the reports the other way round (the newest report is more important then the older ones, so it should come first):

+ Reports
    + NEWLY ADDED REPORT for APRIL
    + Report for MARCH
    + Report for February
    + Report for January

Of course it is possible to move reports around (https://community.atlassian.com/t5/Confluence-questions/In-Confluence-how-can-I-reverse-the-order-of-our-Meeting-Notes/qaq-p/385516), but I'm now looking for a way to automate this. So I'm searching for one of the following:


Solution

  • ok, finally found out how this works. In case someone has a similar problem:

    curl -X GET "https://confluenceServer/pages/movepage.action?pageId=TheIdOfThePageToMove&position=above&targetId=idOfOtherPage" -H "authorization: Basic base64encodedUsernameAndPassword" -H "x-atlassian-token: no-check"