Which Analytics Endpoint to Use to Recreate The Concurrent Viewers Metric?

Hi,

I’ve been trying to recreate dashboard queries via API request. This documentation (Bitmovin Docs - Analytics Tutorials | How to recreate dashboard queries via the API) is being helpful. The difference is, I am doing the request via basic PHP curl (without using any available SDK).

The problem is, I can’t recreate the concurrent viewers metric. Since unlike the other metrics which are using queryBuilder (which are fetch-able using the /analytics/queries/{operation} endpoint), concurrent viewers are fetch-able using metricBuilder only.

Which endpoint should I use to be able to recreate the concurrent viewers metric?
Thanks before.

Best regards,
Phill

1 Like

Hi @phill,

the documentation might be a bit misleading as the Max Concurrent Viewers metric is also available via the API but lives under a different API endpoint than the other queries (which is why it’s not available via the QueryBuilder but only via the `MetricsBuilder). But essentially it’s still the same, just under a different API endpoint.

The API you are looking for is the /metrics endpoint that’s under /v1/analytics/metrics/max_concurrent_viewers.

One helpful trick here is to use the Network Explorer in the Browser while using the dashboard as you’ll see what queries / APIs the dashboard is calling while populating the graphs. That way you can easily see what’s going on and translate that to cURL or plain PHP.

The URL is https://api.bitmovin.com/v1/analytics/metrics/max_concurrentviewers with a payload similar to this:

{
    "metric": "max_concurrentviewers",
    "filters": [],
    "groupBy": [],
    "orderBy": [{
        "name": "DAY",
        "order": "DESC"
    }],
    "start": "2022-08-26T03:36:00.000Z",
    "end": "2022-08-26T06:36:31.882Z",
    "licenseKey": "<LICENSE_KEY>",
    "interval": "DAY",
    "async": false
}

This API is also available via our PHP API Client so if you’re using the PHP SDK that should make it a bit easier.

Hope this helps,
greetings Daniel

1 Like

Hi @tigraine ,

This is definitely a help!
Checking the browser’s network explorer did the trick.
Thank you for the help, Daniel.

Best regards,
Phill

1 Like