0

I want to retrieve the Sitecore content objects in a specified order like ascending or descending. Currently I am using the following query, I want to retrieve the objects in an ascending order.

https://sitecore.mydevinstance.cloud/api/entities/query?query=Definition.Name=='M.Collection'

What are the additional query parameters to specify the order by "Definition.Name".

1

See the documentation of query properties here: https://docs.stylelabs.com/content/3.3.x/integrations/rest-api/query/query_properties.html

Below you can find part of it copied just in case the link above doesn't work anymore:

Sorting

The entity query endpoint supports multi-field sorting. Below are some examples of sort parameters that can be provided in order to apply sorting.

http://hostname/api/entities/query?query=Definition.Name=='M.Task'&sort=DueDate&order=Desc
http://hostname/api/entities/query?query=Definition.Name=='M.Task'&sort=DueDate
http://hostname/api/entities/query?query=Definition.Name=='M.Task'&sort=DueDate:Asc, PropertyName:Desc
http://hostname/api/entities/query?query=Definition.Name=='M.Task'&sort=DueDate,PropertyName
http://hostname/api/entities/query?query=Definition.Name=='M.Task'&sort=DueDate:Desc,PropertyName
http://hostname/api/entities/query?query=Definition.Name=='M.Task'&sort=DueDate:D,PropertyName:Asc
http://hostname/api/entities/query?query=Definition.Name=='M.Task'&sort=DueDate,PropertyType:Asc

Both , and ; field separators are supported. If no sort order is provided for a field the default sort order is Asc. If sorting should be applied in a certain culture you can provide the optional sortCulture parameter.

http://hostname/api/entities/query?query=Definition.Name=='M.Asset'&sort=Description&sortCulture=en-US

Not the answer you're looking for? Browse other questions tagged or ask your own question.