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

Media API Sample: create_playlist

This sample uses the Media API search_videos() READ method, to perform complex searches for videos. You can search any standard or custom data field, and you can have multiple all, any, and none terms to include and exclude videos from the search results. This READ method is called using the JavaScript MAPI wrapper.

You can then create a playlist. This sample uses the Media API create_playlist() WRITE method to create a new playlist. You can either create a manual playlist by choosing a set of video IDs, or 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

Read token (to retrieve list of videos:

API Location:

Return videos that have all of these terms:

Return videos that have any of these terms:

Return videos that have none of these terms:

Sort videos:

Page size:   Page number:

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

Total videos:

Search for Videos


After you select the Search for Videos button, your video list will appear in the Videos to include list below.

Create Playlist

Write Token:

Display Name:

Short Description:

To create a manual playlist (Playlist Type value of Explicit), select videos from the list below. To create a smart playlist (Playlist Type value other than Explicit), set the Filter tags and Tag inclusion rule properties. For a smart playlist, all videos will be un-selected.

Playlist Type (EXPLICIT for a manual playlist):

Videos to include (for a manual playlist):

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

Tag inclusion rule:

Create Playlist

Media API Request

JSON Request

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

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

Media API Response

Response: