> For the complete documentation index, see [llms.txt](https://docs.mediamelon.com/mediamelon/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediamelon.com/mediamelon/smartsight-apis/stream-analytics.md).

# Stream Analytics - Deprecated Page

The following set of APIs are used to query analytical data from video streams

### API Calls

**Live and Video On-Demand (VOD) Stream Analytics**

**GET** /mm-apis/qbrData/vod/{customerId}

**Content-Type:** application/jsonRetrieves analytics of live and on-demand video streams sourced from video players.

**QBR-enabled Packager Analytics**

**GET** /mm-apis/qbrData/live/{customerId}

**Content-Type:** application/jsonRetrieves analytics of QBR-enabled streams sourced from Packagers/Transcoders. Available only when the encoder has been configured with the MediaMelon QBR SDK.

### Required Parameters

The following request parameters are common to both APIs and are required for all queries.

| Request Parameter | Data Type | Data Format                     | Description                                                                              | Example                                 |
| ----------------- | --------- | ------------------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------- |
| dimension         | String    | Comma-separated                 | Required. The attribute(s) of video stream, such as the playback asset.                  | dimmension=asset                        |
| metrics           | String    | Comma-separated                 | Quantifiable attributes of a dimension, such as the number of times an asset was played. | metrics=viewercount                     |
| period            | String    | Comma-separated key-value pairs | The time range to be queried, with start and end in epoch timestamps.                    | period=start=1495599056, end=1495599116 |

### Optional Parameters

The following request parameters are common to both APIs and are optional.

| Request Parameter | Data Type | Data Format                      | Description                                                                  | Example                  |                                                                                                                  |
| ----------------- | --------- | -------------------------------- | ---------------------------------------------------------------------------- | ------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| agg               | Integer   | One of `0` or `1`                | See [Aggregation](/mediamelon/smart-sight-analytics/features.md#aggregation) | agg=1                    |                                                                                                                  |
| aggby             | String    | Single value                     | See [Aggregation](/mediamelon/smart-sight-analytics/features.md#aggregation) | aggby=device             |                                                                                                                  |
| count             | Integer   | One of `0` or `1`                | See [Aggregation](/mediamelon/smart-sight-analytics/features.md#aggregation) | count=0                  |                                                                                                                  |
| filter            | String    | Commma-separated key-value pairs | See [Filtering](/mediamelon/smart-sight-analytics/features.md#filtering)     | <p>filter=city=Bengaluru | SanDiego, device= Smartphone</p><p>\[Returns data for Smartphone devices in Bengaluru and San Diego cities.]</p> |
| limit             | Integer   | Single value                     | See [Pagination](/mediamelon/smart-sight-analytics/features.md#pagination)   | limit=10                 |                                                                                                                  |
| offset            | Integer   | Single value                     | See [Pagination](/mediamelon/smart-sight-analytics/features.md#pagination)   | offset=17                |                                                                                                                  |
| orderas           | String    | One of `ASC` or `DESC`           | See[ Sorting](/mediamelon/smart-sight-analytics/features.md#sorting)         | orderas=ASC              |                                                                                                                  |
| orderby           | String    | Single value                     | See [Sorting](/mediamelon/smart-sight-analytics/features.md#sorting)         | orderby=country          |                                                                                                                  |

### Response

The response is a JSON object containing the following fields.

| Response Field | Data Type | Description                                                                                                                                |
| -------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| totalcount     | Integer   | The total number of records in the result set.                                                                                             |
| pagecount      | Integer   | The number of records returned in the current result set. Will be the size of page in paginated requests. By default, returns all records. |
| response       | Array     | The response is an array of objects, where each object contains key-value pairs of the metrics that are queried for.                       |

**Sample Request and Response**

<https://smartsight.mediamelon.com/api/mm-apis/qbrData/vod/123456?period=start%3D1499773995%2Cend%3D1499775795\\&metrics=assetid\\&dimension=asset\\&agg=1\\&aggby=assetid>

```
{“totalcount”:8,”pagecount”:8,”response”:[{“assetid”:”X-Men”},{“assetid”:”PrisonBreak”},{“assetid”:”Simpsons”},{“assetid”:”GameOfThrones”},{“assetid”:”RaceCar”},{“assetid”:”TearsOfSteel”},{“assetid”:”BigBuckBunny”},{“assetid”:”RickAndMorty”}]}
```

## Old QBR Metrics and Dimensions Definitions

### Common Metrics (QBR-optimized video streams)

These metrics are available for QBR-enabled streams.

| Metric        | SmartSight UI            | Description                                                                                |
| ------------- | ------------------------ | ------------------------------------------------------------------------------------------ |
| Metric        | SmartSight UI            | Description                                                                                |
| cbrbitrate    | Bitrate                  | Original (CBR) bitrate in Mbps                                                             |
| countqualimp  | n/a                      | Count of instances where QBR selected a higher quality segment vs CBR                      |
| countqualred  | n/a                      | Count of instances where QBR selected a lower quality segment vs CBR                       |
| pctbitssaved  | Bits Saved               | Percentage of bandwidth saved by QBR                                                       |
| qbrbitrate    | QBR Bitrate              | QBR bitrate in Mbps                                                                        |
| qualcbr       | Original Avg iMOS        | Original (CBR) quality score (iMOS value)                                                  |
| qualperbitcbr | Original Quality Density | Original (CBR) quality density                                                             |
| qualperbitqbr | QBR Quality Density      | QBR quality density                                                                        |
| qualqbr       | QBR iMOS                 | QBR quality score (iMOS value)                                                             |
| qbrsize       | QBR Traffic              | Actual data downloaded (in MB) with QBR optimization; equal to `cbrsize` when QBR not used |

### Dimension-specific Metrics (QBR-optimized video sessions)

These metrics are available for QBR-enabled streams.

<table><thead><tr><th>Metric</th><th width="160.33333333333331">Dimension</th><th>Description</th></tr></thead><tbody><tr><td>Metric</td><td>Dimension</td><td>Description</td></tr><tr><td>profile</td><td>profile</td><td>Representation index of the video being played</td></tr><tr><td>res</td><td>res</td><td>Stream resolution of the video being played</td></tr></tbody></table>
