# General Guidelines

These API endpoints will help you obtain Video and AD data. This data can be further classified into  QoE and Qos data.&#x20;

The required data can be fetched by using the API endpoints along with combinations of metrics and dimensions. This data can further be diced and sliced and featched by using optional query parameters mentioned here.&#x20;

### Request Query Parameters

<details>

<summary><code>offset</code> integer</summary>

An optional query parameter in integer format to return data with starting index (e.g., `1`)

</details>

<details>

<summary><code>agg</code> string</summary>

An optional query parameter in string format to return data by enabling or disabling aggregation (values: 1 or 2)

</details>

<details>

<summary><code>aggby</code> string</summary>

An optional query parameter in string format to return aggregated data with aggregation by (eg.: `subscriberid={subscriber-id}`)

</details>

<details>

<summary><code>order</code> string </summary>

An optional query parameter in string format to return data in order (e.g., `DESC`OR `ASC`)

</details>

<details>

<summary><code>orderby</code>string</summary>

An optional query parameter in string format to return data with order by (eg.: `viewercount`)

</details>

<details>

<summary><code>limit</code> string</summary>

An optional query parameter in string format to return maximum number of records (e.g., `10`)

</details>

<details>

<summary><code>filter</code> string</summary>

An optional query parameter in string format to return data with filter criteria (e.g., `subscriberid={subscriber-id})`

</details>

<details>

<summary><code>granularity</code> string</summary>

An optional query parameter in string format to return granularity of the data (e.g., minute, hour, day).&#x20;

</details>

<details>

<summary><code>sessiontype</code> string</summary>

Type of sessions to query ("ended" or "started") . This is used for accounting the metric at session start or end.

</details>

<details>

<summary><code>qoefilter</code> string</summary>

Metric filter. This is used to specify metric filters (eg. bufferingratio > 10 , buffcount > 1 ).  The metric filter is applied at a session level. So bufferingratio > 10 will filter all the sessions which have bufferingratio > 10%.

</details>

### General Guidelines

To query for totals or averages of metrics over any time range, use the following parameters in the API call:

* `agg=1`

To query for totals or averages of metrics over any time range grouped by different values of a dimension, use the following parameters in the API call:

* `agg=1`
* `aggby=<name_of_primary_metric>`

To query for total plays per asset, use the following parameters in the API call:

* `count=1`
* `agg=1`
* `aggby=assetid`

To query for timeline trends, use the following parameters in the API call:

* `metrics=timestamp,<all_other_metrics>`
* `agg=1`
* `orderby=timestamp`

To filter data on a particular dimension, use the following parameters in the API call:

* `metrics=<filter_metric_name>`
* `filter=<filter_metric_name><operator><value>`
* `agg=1`

To filter data of an asset, use the following parameters in the API call (e.g asset name is GameOfThrones) :&#x20;

* `metrics=assetid`
* `agg=1`
* `filter=assetname=GameOfThrones`

To query for totals or averages of metrics for a particular dimension value, use :

* `agg=1`
* `filter=<metric name><operator><value>`

To query for total play time of an asset, use the following parameters in the API call (e.g asset name is GameOfThrones) :&#x20;

* `metrics=assetid,playdur`
* `count=1`
* `agg=1`
* `filter=assetname=GameOfThrones`

To sort responses, use:

* `orderby=<metric_name>`
* `order=DESC or order=ASC`
