I'm wondering if there is a way to retrieve the item children in batches, I saw this ability other REST APIs where we can set pagination parameters like startIndex and itemPerPage.
1 Answer
You can do this in the Item Web API.
Basically you have 2 parameters
- page: Specify the page number in the result set of pages that the service shows.
- pageSize: Specify the number of results the service returns in the HTTP response.
Which will control how many items you get, and which virtual "page" to start from.
Example: /item/{id}/query?pageSize&page&database&includeStandardTemplateFields&fields
If you want to do it in native c# code
There is no such option. Basically when you hit GetChildren()
or the .Children
property of an item
- all children will be resolved. This is also true for Item Web API querying, but you save a bit of bandwidth by only returning a subset.
-
Hey @mark-cassidy, to use the
/query
service, do we need extra configurations in the Sitecore side(or item)? From the documentationYou use this method to run (“execute”) a query that is stored in a Sitecore item
, does that mean we need to set a query to each item? Commented Sep 10, 2018 at 14:57 -
That was just an example. If you follow the link, there are many types of queries you can be doing. It's basically a full REST API implementation, you can get items, delete items and so on.– Mark Cassidy ♦Commented Sep 10, 2018 at 15:38