Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,465
Community Members
 
Community Events
165
Community Groups

Order of content children in REST API response

Experimentally, I am finding that the order of the items in the response to a `GET /wiki/rest/api/content/{id}/child` API call is the same as the order in which they appear in the WEB UI.

The API documentation does not actually say anything about the order though, so I am nervous about relying on that.

If the order cannot be relied upon, I see that there is a `position` extension in the results that seems to represent the display order, but that is not mentioned in the API documentation, so I don't know if I can rely on its meaning or continued existence.

Can all of this be clarified in the documentation?

1 answer

0 votes
Jessica Atlassian Team Jun 21, 2022

Hi Steve,

I'm not sure if I got your question right, so I'd like to ask for more details on what exactly is this position and display order of results you mentioned and what are you looking to clarify.
Would be the ones under for example:

  • https://<sitename>.atlassian.net/wiki/rest/api/content/<pageID>/child?/comment

And what is shown under the expandable, such as body, for example?

The link to the documentation along with additional information for your use case would be useful for us to understand your concern a little better. :) 

Assuming that you are trying to follow the REST API Get content children with the provided path:

  • /wiki/rest/api/content/{id}/child or https://<sitename>.atlassian.net/wiki/rest/api/content/<pageID>/child, you should see the expandable options that you can explore, which are the content type of the pageid used:
    E.g: https://<sitename>.atlassian.net/wiki/rest/api/content/<pageID>/child/comment
  • page: child content is page, comment, attachment
  • blogpost: child content is comment, attachment
  • attachment: child content is comment
  • comment: child content is attachment

So, in order to retrieve for example, all comments in the specified page, you could use the following:

https://<sitename>.atlassian.net/wiki/rest/api/content/<pageID>/child/comment?expand=body.view

For reference, all other expendables are listed here: Get content children by type 

Hope that helps, but in case you concern is a bit different, please let us know.

Cheers,
Jessica

Thanks for replying.

No. That's not exactly what I'm asking.

In this case, I am actually getting child pages of a page (so https://<sitename>.atlassian.net/wiki/rest/api/content/<pageID>/child/page) and I'm talking about the order in which the child pages appear in the content array in the response data.

I need to know the order that the child pages appear when viewed through the Web UI. Experimentally, it seems that the items in the content array are the same as the order in which they appear in the Web UI, and each item in the response also contains an `extensions.position` value (not an expandable) with values that are in ascending order (though not sequential) corresponding with the position.

Neither the order if entries in the response nor the meaning of that extension appear to be mentioned in the documentation, so I don't know whether I can rely on either of those.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

743 views 5 21
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you