WARNING: This API has been deprecated and should not be used for new projects. Support for write methods were discontinued on June 30, 2017, and read methods will be discontinued on December 31, 2017. Click here for more information.

Media API Sample: share_video

This example uses the search_videos() READ method, which allows you 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. All READ method samples are made using the JavaScript MAPI wrapper.

You can then select a video from the drop-down menu and share it. This sample uses the Media API share_video() WRITE method to share a video from one account to another. It will also force a re-share if the video has already been shared. Note: sharing must be enabled between the two accounts for this to work.

There are hard-coded values from a Brightcove Learning demo account that you can use to test with, or you can substitute a write token and video ID from your own account, along with the ID for account you wish to share to.

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 Video to share drop-down menu below.

Share Video

Write Token:

Video to share:

Sharee Publisher Id's (comma separated):

Share Video

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 share the selected video:

Media API Response