Introduction
It's sometimes useful to get a count of videos or playlists in your account, or how many videos have been added in the past month or year. You can easily get these kinds of counts using the /counts/
endpoint for the CMS API.
Authentication
Requests to the CMS API require an authorization header which contain your access tokens. For details on how to obtain client credentials and use them to retrieve access tokens, see the Brightcove OAuth Overview.
Get video counts
To get a count of videos, make a GET
request to:
https://cms.api.brightcove.com/v1/accounts/{account_id}/counts/videos
The response will look like this:
{
"count": 4999
}
What makes the video counts endpoint so powerful is that you also append a search parameter to the request. This allows you to get a count of whatever videos the search would return. Because the search parameter is so flexible, this allows you to get a count of many things, such as:
- the number of videos that have a particular tag or a specific value for a custom field
- the number of videos added in the last year (or month, or week, etc.)
- the number of videos that are currently playable
- the number of videos scheduled for release next week
Get playlists count
You can also get a count of playlists in your account by making a GET
request to:
https://cms.api.brightcove.com/v1/accounts/{account_id}/counts/playlists
The response has the same format as the one for video counts.
You can also use the search parameter in playlist count requests. So, for example, you could find out how many manual playlists are in the account by appending q=type:EXPLICIT
to the request.
In addition, you can get the count of videos in any manual or smart playlists by making your GET request to:
https://cms.api.brightcove.com/v1/accounts/{account_id}/counts/playlists/playlist_id/videos