Streaming live at 10am (PST)

API - how to order collection items in response


#1

Hi,

I’m making an API call to get a list of items in a collection (I’m using limit and offset in the API call which will be set dynamically depending on the user who is logged in).

It’ll be something like this:

https://api.webflow.com/collections/COLLECTION_ID/items?limit=10&offset=5

This will return me the 5th to 15th items in a collection, however is there a way to select the 5th to 15th items in the collection if I order by a particular field in that collection - for example order by “Published Date” or to order by “Sorting” field? Not sure if this is possible! Any ideas would be great - how is this achieved in the front end when ordering a Collection List in the Designer?

Thanks!
Andrew


#2

Hi @andrewrubio

I can’t advise on the API side, but in the Designer you can order a collection list by choosing ‘limit items’ in the sort/filter and then specifying the range.

You can also look at giving the collection a # number field, and each item you want ordering a number - then in the collection list using ‘sort order’ to read from that field…

Hope that helps


#3

According to the documentation, there are no filtering or sorting paramaters. There is only limit and offset.

http://developers.webflow.com/#get-all-items-for-a-collection