Best Practices: CMS and Playback APIs
Both the CMS and Playback APIs provide access to your Video Cloud video data. The purpose of this topic is to help you understand the difference between them and the best practices for using them.
Differences between the CMS and Playback APIs
The CMS and Playback APIs access the same underlying video data. There are some key differences between them that should determine which one you use in particular situations, however.
Generally speaking, the CMS API is intended for backend use, such as integrating Video Cloud with your CMS system. The Playback API is intended for frontend use to fetch video and playlist data for players or video portals (the Brightcove Player
playlist APIs use the Playback API, for example).
The table below lists some key differences between the two APIs.
|Item||CMS API||Playback API|
|Kinds of operations||create, read, update, delete||read-only - no data can be modified using the Playback API|
|Scope of operations||Manage every aspect of your video data||Fetch specific videos or playlists, or search for videos|
|Authentication||Temporary access tokens||Permanent policy keys|
|Freshness of data||No caching, always current||Cached for up to 20 minutes|
|Speed of responses||Slower||Faster (because of the caching)|
|Access||Server-side only (CORs disabled)||Server or client-side (CORs enabled)|
|Data||Video and playlist requests do not include video source URLs; a second request is required to get those||Video and playlist requests do include video source URLs|
Using Media URLs
It is important to understand that URLs for renditions, images, and other assets are not fixed. Brightcove reconfigures the storage of media assets from time to time, and when this happens, URLs for specific assets will change. If you are relying on hard-coded URLs to these assets in your pages or apps, the links will break at some point.
In addition, all URLs contain a
TTL token for content security reasons. This means that the URLs expire after 6 hours by default. The life of the token can be extended up to 365 days - if you want longer-lived tokens, Contact Brightcove Support. Be aware, however, that the
TTL reflects the maximum time that asset will be cached by the CDN, but is not a guarantee that the URL will not change before the token expires.
If a runtime API request is not an option, then we recommend getting the URL(s) from a local data cache that is refreshed at least once a day, or within the time-to-live set for your
TTL tokens, whichever is shorter.
Reference id conflicts
This section applies to the CMS API only.
To insure the uniqueness of reference ids, the CMS API locks the id for up to 3 minutes after any operation on the video it is assigned to. This can result in 409 errors being returned when you attempt to retry a request that fail too quickly, or when you try to reuse a reference id too soon after deleting the video it was previously assigned to. See the Error Message Reference for more details.