# Smartquery Insights

This guide will help you fetch metrics and dimensions used to compile Smartsight Smartquery Insights dashboard. &#x20;

### Show Content Path <mark style="color:green;">GET</mark>  <a href="#plays" id="plays"></a>

Returns the content journey of the users.&#x20;

{% code overflow="wrap" lineNumbers="true" %}

```bash
curl 'https://smartsight3.mediamelon.com/mm-apis/smartQuery/<customer-id>?planlevel=<level>&period=start=1729666800,end=1730271600&queryname=contentpath'
-x GET --header 'Authorization: Bearer <access_token>'
```

{% endcode %}

{% hint style="info" %}
If you run this request yourself it will not work,  you should replace the \<access\_token> in this example with your own Keycloak access\_token you get by running [Fetch Auth Token](https://docs.mediamelon.com/mediamelon/smartsight-apis/accessing-the-api#auth-token)
{% endhint %}

#### Required request path parameters

<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>customer-id</code> string</td><td>A path parameter in form of a string. This is the unique identifier and you will be able to find this Id on your user profile page.</td><td></td></tr></tbody></table>

#### Required request query parameters

<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>planlevel</code>string</td><td>A  query parameter in form of a string. This is the plan identifier number associated with CustomerID and you will be able to find this plan level using https://smartsight.mediamelon.com/planLevelByCustId/&#x3C;customer-id></td><td></td></tr><tr><td><code>period</code> string</td><td>A query parameter in comma-separated string format. It needs to in the format of start date and end date (eg: start=1729666800,end=1730271600) in epoch time. For reference, use this <a href="https://www.epochconverter.com/">Epoch Time converter</a></td><td></td></tr><tr><td><code>queryname</code>string</td><td>Combination of query parameters <code>queryname=contentpath</code> in string format. This request needs comma-separated metrics to retrieve the rquested data. </td><td></td></tr></tbody></table>

#### &#x20;Response

<details>

<summary><mark style="color:green;">GET</mark>  <mark style="background-color:green;">200</mark></summary>

{% code lineNumbers="true" %}

```json
{
    "totalcount": 1000,
    "pagecount": 239103,
    "response": [
        {
            "assetname": "Oh My My Cit (start)",
            "next_assetname": "Weddings Hopefuls (dest)",
            "Weight": 8376,
            "totalpages": 239103
        },
        {
            "assetname": "Weddings Hopefuls (start)",
            "next_assetname": "Windy City Chicago (dest)",
            "Weight": 8342,
            "totalpages": 239103
        },
        {
            "assetname": "Thieves Were Caught on Tape (#101) (start)",
            "next_assetname": "Thieves Were Caught on Tape (#102)(dest)",
            "Weight": 3931,
            "totalpages": 239103
        },
        {
            "assetname": "The Nanny (start)",
            "next_assetname": "Hiding Family (dest)",
            "Weight": 128,
            "totalpages": 39376
        },
        .
        ..
        ...
        ....
        .....
        {
            "assetname": "Run (start)",
            "next_assetname": "911 (dest)",
            "Weight": 162,
            "totalpages": 239103
        },
        {
            "assetname": "Robinson Story (start)",
            "next_assetname": "Her (dest)",
            "Weight": 162,
            "totalpages": 239103
        }
    ],
    "totalrecords": 239103
}
```

{% endcode %}

</details>

***

### Show Subscriber Insight <mark style="color:green;">GET</mark>  <a href="#plays" id="plays"></a>

Returns subscriber details

{% code overflow="wrap" lineNumbers="true" %}

```bash
curl 'https://smartsight3.mediamelon.com/mm-apis/smartQuery/<customer-id>?planlevel=<level>&period=start=1729666800,end=1730271600&queryname=subscriberdetails'
-x GET --header 'Authorization: Bearer <access_token>'
```

{% endcode %}

#### Required request path parameters

<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>customer-id</code> string</td><td>A path parameter in form of a string. This is the unique identifier and you will be able to find this Id on your user profile page.</td><td></td></tr></tbody></table>

#### Required request query parameters

<table data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><code>planlevel</code>string</td><td>A  query parameter in form of a string. This is the plan identifier number associated with CustomerID and you will be able to find this plan level using https://smartsight.mediamelon.com/planLevelByCustId/&#x3C;customer-id></td><td></td></tr><tr><td><code>period</code> string</td><td>A query parameter in comma-separated string format. It needs to in the format of start date and end date (eg: start=1729666800,end=1730271600) in epoch time. For reference, use this <a href="https://www.epochconverter.com/">Epoch Time converter</a></td><td></td></tr><tr><td><code>queryname</code>string</td><td>Combination of query parameters <code>queryname=subscriberdetails</code> in string format. This request needs comma-separated metrics to retrieve the rquested data. </td><td></td></tr></tbody></table>

#### Response

<details>

<summary><mark style="color:green;">GET</mark>  <mark style="background-color:green;">200</mark></summary>

{% code lineNumbers="true" %}

```json
{
    "totalcount": 1000,
    "pagecount": 0,
    "response": [
        {
            "starttime": 1729728000,
            "sessionid": "525e447a7b8700-8ma7b_svod-roku-native",
            "device": "Roku",
            "platform": "Roku OS",
            "player": "svod-roku-native",
            "brand": "svod-roku-native",
            "model": "55S423",
            "assetname": "The Sex Therapist",
            "contenttype": "0",
            "attempts": 1,
            "viewercount": 1,
            "playdur": 2572.0,
            "errors": 0,
            "latency": 0.526
        },
        .
        ..
        ...
        ....
        .....
        ......
        {
            "starttime": 1729641600,
            "sessionid": "27b4f980fe7458-4m45d_tve-roku-native",
            "device": "Roku",
            "platform": "Roku OS",
            "player": "tve-roku-native",
            "brand": "tve-roku-native",
            "model": "Roku Express",
            "assetname": "Part 1: Charismatic Leaders and Faithful Followers",
            "contenttype": "0",
            "attempts": 1,
            "viewercount": 1,
            "playdur": 675.0,
            "errors": 0,
            "latency": 0.658
        }
    ],
    "totalrecords": 0
}
```

{% endcode %}

</details>
