Overview: Video Data Endpoint

In this topic, you will learn how to use the video data endpoint for the Analytics API.

Introduction

The video data endpoint provides a quick way of getting specific data for a particular video. Current requests will return the alltime views for the video. In the future, additional data may be returned. The primary use case for this end point would be delivering alltime views information to players on high-traffic pages, where making large volumes of regular requests to the Analytics API would be too slow.

Endpoint

The endpoint for video data requests is:

      https://analytics.api.brightcove.com/v1/alltime/accounts/{{account_id}}/videos/{{video_id}}
    

All requests are GET.

Authentication

All requests to the Analytics API are authenticated via Brightcove's OAuth service.

Authentication is based on an access token passed in an Authorization header:

      Authorization: Bearer {your token}
    

You can get client credentials for the Analytics API and use those to retrieve temporary access tokens - see the OAuth Overview for an explanation of different approaches you can use to obtain client credentials and access tokens, and Managing API Credentials for information on obtaining client credentials through Studio

Response

The response to a request will be JSON in the form:

        {
          "alltime_video_views": 103123
          }
        
      

Possible Implementation

Here is how you might use the video data endpoint to display alltime views for a video when it loads in a player:

  1. Set up caching to store views by video id for 5-10 minutes.
  2. Create logic on your server or in your pages to first check the cache to see if the alltime video views data for the current video is already there, and if so, use it.
  3. If the value is not already cached, make a request to the video information endpoint to retrieve it, and store the value in the cache along with displaying it in the page.
  4. Be sure to set up exception handling in case the request to the video information endpoint times out or is unsuccessful - you might simply not display the alltime video views, or you might use the last value you have.

     

Implementation Diagram
Implementation Diagram