description |
---|
Count, Offset and Sort |
Starting in version 0.49
, some of the endpoints support the query parameters offset
, count
and sort
. However, the defaults are different per server due to configuration settings.
Parameter | Example | Description | Format |
---|---|---|---|
offset |
50 |
Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items |
Positive integer |
count |
50 |
How many items to return. | Integer |
sort |
{"value": -1, "_id": 1} |
List of fields to order by, and in which direction | JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. |
These are the settings for the REST API which relate to the offset and count. If you need to change them, go to Administration -> General -> REST API
.
API_Default_Count
(Default Count) - Defines the defaultcount
for when the parameter is not providedAPI_Upper_Count_Limit
(Max Record Amount) - Defines ceiling for thecount
and this value will be set if thecount
is higherAPI_Allow_Infinite_Count
(Allow Getting Everything) - Determines whether0
can be passed into thecount
to allow getting all of the records.
To limit the results to 5 items and to get the third "page", you would provide count=5
and offset=10
.
http://localhost:3000/api/v1/channels.list?count=5&offset=10
To sort by name descending, and status ascending, you would provide sort={"name":-1,"status":1}
http://localhost:3000/api/v1/users.list?sort={"name":-1,"status":1}