Indexes, videos, and tasks
The endpoints that return lists of items support filtering. You can use the following parameters to control sorting behavior:
- Sorting criteria: Use the
sort_by
parameter to specify the field you want to sort on. The following options are available:updated_at
: Sorts by the date and time when the item was updated.created_at
: Sorts by the date and time when the item was created.
- Sorting direction: Use the
sort_option
parameter to specify the sorting direction. The following options are available:asc
: For ascending order.desc
: For descending order. This is the default value.
The examples in this section are specific to listing your video indexing tasks. The same principles apply to other similar endpoints.
Prerequisites
- You’re familiar with the concepts that are described on the Platform overview page.
- You’ve already created an index.
- You’ve already uploaded a video.
Examples
Sort by creation date
To sort items by their creation date, invoke the list
method on the task
object, specifying "created_at"
for the sort_by
parameter.
The following output was truncated for brevity:
Specify the sort order
The example code below demonstrates how to sort items by their creation date in ascending order. Specify "created_at"
for the sort_by
parameter and "asc"
for the sort_option
parameter to reverse the default sorting order:
The following output was truncated for brevity:
Combine sorting and pagination
The following example code sorts items by their creation date and specifies that each page should contain 5
items:
The following output was truncated for brevity: