Getting started with the Api Explorer
The API Explorer is a playground where you can model your own data requests. This is a great place to play around with the given tools and build what we call an analytics query. This query holds all the information needed to fetch the data you want to see. In this section you’ll learn how to build a query using our api sdk.
Checkout How to recreate dashboard queries via the api to see how the metrics in the analytics dashboard are build under the hood.
The Query Editor
The top panel on the page is the place where you can build the query. The code will be written in JavaScript. But don't worry you don't need to be an expert in that to use this tool.
We have setup some assistance for you to speed up the process:
- It uses our API SDK in order to build the query with an SQL like touch.
- It will update the selected license automatically so all you need to do is to select the right one in the Licenses Selector on top.
- It will also always attempt TypeAhead - that is, if you begin to type, the UI will complete the word or command for you.
My First Query
- Log into the bitmovin dashboard UI and select the Analytics dropdown, then API explorer.
- Completely erase all the sample content in the box
- Type
queryBuilder
(note how type-ahead fills in the word after the first couple of characters, highlight and click or hit return). There's the option to use themetricsBuilder
to query for certain metrics directly: e.g.max_concurrentviewers
- Now select a license using the License Selector on top. Note how the licenses key has automatically been added to .licenceKey(). This is the licence key of the currently selected one.
- Adjust your target dates in the “Show Metrics Between” menu at the top, then hit
Apply Dates
button in the top right of the editor, note how this inserts the.between
dates in the script. - Adjust the filters in the “Global Filter” menu at the top, then hit
Apply Filters
button in the top right of the editor, note how this inserts the.filter
elements in the script. - Last we need to set a metric we are interested in. In a new line write
.count(‘PLAY_ATTEMPTS’)
- Close the query with the .query() line, and hit the "Run" button.
Your script should now have been auto-generated something similar to:
queryBuilder
.between('2023-01-01T00:58:28.454Z', '2023-01-04T00:58:28.454Z')
.filter('OPERATINGSYSTEM', 'NE', 'Android')
.licenseKey('<ANALYTICS_LICENSE>')
.count('PLAY_ATTEMPTS')
.query()
The results should appear in the box below.
Converting APIExplorer into a standalone API call.
Once you are happy with the output to your query press the "Copy" button. This will put the payload representation of your query into your clipboard. You can use this payload to perform http calls directly to our API endpoints.
Or, open Chrome Inspect’s network monitor, rerun the query, and see the same RESTful POST contained in the list (marked as “count”), right click, extract as cUrl.
Design Limitations
- The maximum number of groups from the groupBy instruction is 200 with a cardinality of 10,000 records.
- Various tricks are available to get around these design limitations so please make contact to discuss your needs.
Updated 12 months ago