How to Export Your Data With the v2 Analytics API (Deprecated)
Was this article helpful?
The following information will guide you on retrieving and saving your analytics v2 data.
- All customers will have access to reprocessed data starting from January 1, 2014.
- You will continue to have access to the old v2 Analytics API until June 30, 2016.
Overview: The Ooyala v2 Analytics API
With the Ooyala v2 Analytics API you can easily create a report that will provide you with your analytics data. The results will be in JSON format. (JSON is a lightweight data-interchange format that is easy to read and write.)
To retrieve analytics results from a specific date range you simply need to define the type of result you need with the api call /v2/analytics/reports/, either in a terminal emulator such as Terminal on a Mac or in the Ooyala Scratchpad.
What is an API?
In computer programming. API (Application Programming Interface) is the name of a set of routines and protocols for software applications. An API expresses a software component in terms of its operations and results.
Where can I locate my API Credentials?
How Does the API Work?
An Ooyala API call requires 4 basic elements: API Key, API Secret, a Signature and an Expiration time.
API calls are made via HTTP methods. The GET API call is used to retrieve data without directly modifying it and allows you to get a typed JSON document response based on the id of the object.
What are the Available Results I can Retrieve with the Ooyala v2 Analytics API?
On the v2 Analytics API there are 4 key qualifiers that you need to identify in order to retrieve your results:
asset_id: This value is referred to by different names depending on where you look for it. In the Backlot API, asset_id is the identifier for a specific asset. asset_id has the same value as the content ID found in the Backlot UI that represents a piece of content. The value is the same for all scenarios. asset_id can be used if you want to retrieve results for a specific asset. Alternatively, you can retrieve results for your account, which would include all of your assets.
date_range: Defines the date range for this report. Analytics is based on dates. You can define the date following the format (YYYY-MM-DD) or you can define a date range with (YYYY-MM-DD...YYYY-MM-DD).
Dimension: Dimensions are common criteria that are used to aggregate data, such as the date when the user activity occurred or the country where the users were located. Every Dimension also has “Drilldowns”, which allow you to filter your results by specific values for each dimension.
Common query string parameters and attributes can be found at Common Attributes and Query String Parameters (Deprecated).
How to Retrieve Your v2 Analytics Data
What is the API Call Format?
The v2 Analytics API follows a specific order on the body of the API.
For example, the API call: /v2/analytics/reports/account/performance/[:dimension/:drilldown]/:date_range
How Can I Use the Scratchpad to Save Reports?
The Scratchpad is a tool created by Ooyala that allows you to make API queries in your browser.
- Go to Ooyala API Scratchpad.
- Select “Your Account” in the Credentials section in the upper right corner of the page.
- Enter your v2 API credentials (API Key and Secret) in the Credentials section in the upper right corner of the page.
- In the Query field located on the left side of the page, enter your Analytics query. For example, if you would like to get the performance report from 2011 to 2014, copy and paste this query: /v2/analytics/reports/account/performance/total/2011-01-01...2014-01-01
- Select GET.
- Click Submit. Note: Your response appears in the response field.
- If you prefer to see your results in a larger browser window, copy the API URL shown in green above the Submit button into your browser. In this case, the URL would be https://api.ooyala.com/v2/analytics/reports/account/performance/total/2011-01-01...2014-01-01?api_key=yourApiKey&signature=yourSignature&expires=1418771221.
- Save the JSON by selecting File > Save As… in your browser. For information on how to convert JSON to CSV, see Converting Analytics JSON to CSV (Deprecated)
Additional Query Examples
How can I Create my own API Report?
You should only create your own API script if you are comfortable with the Ooyala API and have created scripts before or if you have the technical resources available who can modify the pre-made query to retrieve the data for you.