I need to retrieve all the posts from the "Posts" list in a Sharepoint Blog site and sort the results depending on the "NumberofLikes". How can i achieve this?
&$orderby=LikesCount desc
does not work with Rest API url. How can i sort the items based on the number of likes. How can i achieve it?
Muthu KumarPosted Feb 28, 2019, 11:38 PM
Here is an example for order by,
Ascending Order: /_api/web/lists/getbytitle('infolist')/items?$select=ID,Title,Employee,company&$orderby= Employee asc
Descending Order: /_api/web/lists/getbytitle('infolist')/items?$select=ID,Title,Employee,company&$orderby= Employee desc
Replace your field in that orderby place.
Reference:-
https://social.technet.microsoft.com/wiki/contents/articles/35796.sharepoint-2013-using-rest-api-for-selecting-filtering-sorting-and-pagination-in-sharepoint-list.aspx