Counting the Videos in your Media Library

Product
Video Cloud
Applies to Roles
Developer
Version
Brightcove 5
Modules
Media API
Edition
Express 499, Pro, Enterprise

This topic describes a way to find the total number of videos in your Video Cloud account, using the Media API.

Do you wonder how many videos you have in your Video Cloud account? Instead of trying to count them in the Media module, you can use the Media API find_all_videos method to return that number in the total_count value. In your find_all_videos call, set get_item_count=true to return the number of active videos. So that you don't get too much other data you don't need, set video_fields to a single field, like name, and set page_size=1 and page_count=0, so that the method returns a single page with a single video on it. This makes it easier to find the total_count value in the return data. 

For example:

http://api.brightcove.com/services/library?command=find_all_videos&page_size=1
  &get_item_count=true&video_fields=name&token=lYG1Bb0us7JHoRL8F6jZmEecQviwy30.

The JSON returned looks like:

{"items":[{"name":"Monkey"}],"page_number":0,"page_size":1,"total_count":17}

Note that the Media API read methods return information only about active videos, so this will just tell you the number of active videos, not the total number of videos in your account.

Tags
count, sum, total number of videos