put https://api.zype.com/playlists/
Smart Ordering
Playlist smart ordering allows you to change the order of its videos by sort options. The videos added or updated into a playlist with sort options are sorted automatically following that sort option
Parameter | Function | Type |
---|---|---|
playlist[sort_options] | An array of sort options. Only two levels of sorting are accepted and videos are sorted first by first level, and second by second level | Array |
Every sort_option
has three fields:
direction
: The direction to sort the results. It accepts two values:asc
(ascending - lowest to highest) anddesc
(descending - highest to lowest) order.sort_by
: The field name which will be taken into account to sort the results. It accepts the following values:created_at
,published_at
, andtitle
.sort_by_type
: The type of the field which will be taken into account to sort the results. It accepts the following values:date
,datetime
,string
,integer
,array
, andboolean
. The difference betweendate
anddatetime
is thatdate
will only take the date part of the field, whiledatetime
will take the date and time part of the field; so for example, for a date "01/01/2001 01:01:01",date
will take only "01/01/2001" into account, whiledatetime
will take the complete date "01/01/2001 01:01:01" into account.
Here is an JSON example to be set as the body to update a Playlist with one level smart ordering:
{
"playlist": {
"sort_options": [
{
"direction": "desc",
"sort_by": "published_at",
"sort_by_type": "datetime"
}
]
}
}
And with two levels smart ordering:
{
"playlist": {
"playlist title": "Title",
"sort_options": [
{
"direction": "desc",
"sort_by": "published_at",
"sort_by_type": "datetime"
},
{
"direction": "asc",
"sort_by": "title",
"sort_by_type": "string"
}
]
}
}