WARNING: This API has been deprecated and should not be used for new projects. Click here for more information.

Media API Sample: update_playlist

This sample uses the Media API find_all_playlists() READ method, to return all the playlists in an account. This READ method is called using the JavaScript MAPI wrapper.

You can then select a playlist and update it. This sample uses the Media API update_playlist() WRITE method to update a playlist. You can update a playlist by choosing the video IDs you would like to retain, or you can create a smart playlist by choosing the tag filters and ordering method.

There are hard-coded values below from a Brightcove Learning demo account that you can use to test with or you can substitute the read and write tokens for your own account.

Note: you should never hard-code your tokens into a client-side application in the manner shown here for demonstration purposes only. Also be aware that even if you require the use to enter the token, it will be transmitted as plain text unless the form submits over an https connection.

View the source for this page to see the code.

Search Input

Since the find_all_playlists() READ method does not support sorting, the playlist data is sorted on the client side using the JavaScript sort() method. You may want to make the page size large as each page is sorted separately after the data is returned. The maximum page size returned from the API is 100 records.

Read token (to retrieve list of videos:

API Location:

Sort Playlist name:

Page size:   Page number:

Only the first page is available until you make a search; then the available pages are recalculated.

Total playlists:

Search for Playlists


After you select the Search for Playlists button, your playlists will appear in the Select playlist to update drop-down menu below.

Update Playlist

Write Token:

Select playlist to update:

Video to include (for a manual playlist - you must select all videos you want to retain in the playlist):

Display Name:

Short Description:

Playlist Type (EXPLICIT for a manual playlist):

Filter Tags (for smart playlists — comma-separated, no spaces):

Tag inclusion rule:

Update Playlist

Media API Request

JSON Request

Below is the request sent to the Media API service to retrieve playlists:

Below is the request sent to the Media API service to update a playlist:

Media API Response

Response: