Sorting Youtube API result from playlist

This does seem to be a limitation currently of the YouTube API and seems quite short-sighted by its creators.

This doesn't solve your exact problem, but for others having a similar problem, I found that using the 'search' query you can order to a certain extent.

This helped me order a playlist (not playlistItems) query by searching for playlists rather than requesting a list of playlists. Thus my query:

https://www.googleapis.com/youtube/v3/playlists?part=snippet&maxResults=20&channelId={channelID}&key={API_KEY}

became:

https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&order=date&safeSearch=none&maxResults=20&channelId={channelID}&key={API_KEY}

You can also search for videos and query terms and several other parameters, so maybe you can get the results you want this way.


The current API doesn't have a sorting option for listing playlist items, but if you are inserting the items programmatically, you can specify the position value when inserting to make new videos appear at the top of the list.

If it's someone else that is adding the videos, than you'll have to get all pages. Since the playlists are limited to 200 items, this requires 4 requests at most. Not ideal, but it's the only option now.