Best Practices: CMS and Playback APIs

Product(s)
Video Cloud
Role(s)
API Developer
API(s)
CMS API
Playback API

This topic provides best practices for using the Catalog APIs (CMS and Playback APIs).

Introduction

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 catalog and playlist APIs use the Playback API, for example).

The table below lists some key differences between the two APIs.

CMS vs Playback
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.

The best way to prevent links to media from breaking is to retrieve them from Video Cloud at runtime using the CMS API or the Playback API.

Caching URLs

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.