# API Routes - reports

## Systems - get systems

<mark style="color:blue;">`GET`</mark> `https://admin.serverside.ai/api/v2/systems`

This route lists all of your systems. You will need the system id to list or query reports.

#### Path Parameters

| Name      | Type   | Description                    |
| --------- | ------ | ------------------------------ |
| x-api-key | string | Your **serverside.ai** API key |

{% tabs %}
{% tab title="200 " %}
```
[
    {
        "_id": "5d80ead4eb46fe2ea810a244",
        "name": "ams",
        "type": "azure-media-services",
        "settings": {
            "resourceGroup": "<RESOURCE GROUP>",
            "activeDirectoryClientSecret": "<A SECRET>",
            "storageAccount": "<ACCOUNT NAME>",
            "azureMediaServiceName": "<SERVICE NAME>",
            "activeDirectoryTenantId": "<UUID>",
            "storageKey": "<STORAGE KEY>",
            "activeDirectoryClientId": "<UUID>",
            "azureSubscriptionId": "<UUID>",
            "container": "<CONTAINER>"
        },
        "id": "<UUID>",
        "createdBy": "user@company.com",
        "createdAt": "2019-09-17T14:16:52.669Z",
        "tenant": "Another New Company",
        "__v": 0
    },
    {
        "_id": "<ID>",
        "name": "ssai",
        "type": "ssai",
        "settings": {
            "url": "https://staging-live.serverside.ai/channel-api/api/v1/channels",
            "username": "<USERNAME>",
            "password": "<PASSWORD>",
            "elasticSearchDomain": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxx.eu-central-1.aws.cloud.es.io:9243",
            "elasticSearchUser": "<USER>",
            "elasticSearchPassword": "<PASSWORD>",
            "elasticSearchIndex": "<INDEX>"
        },
        "id": "<GUID>",
        "createdBy": "user@company.com",
        "createdAt": "2019-09-17T14:15:28.902Z",
        "tenant": "Another New Company",
        "__v": 0,
        "modifiedAt": "2019-09-25T09:18:52.382Z",
        "modifiedBy": "user@company.com"
    }
]
```
{% endtab %}
{% endtabs %}

## Reports - get reports by system

<mark style="color:blue;">`GET`</mark> `https://admin.serverside.ai/api/v2/systems/:systemid/reports`

This route lists all the report names for a system. Use the id (UUID) from the GET systems route above.

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| :systemid | string | id (UUID) of the relevant system. |

#### Headers

| Name      | Type   | Description                    |
| --------- | ------ | ------------------------------ |
| x-api-key | string | Your **serverside.ai** API key |

{% tabs %}
{% tab title="200 " %}
```
[
    "Incoming-Events",
    "Event-Count",
    "Ad-Campaign",
    "Audience-Share",
    "Viewing-Time",
    "Unique-Users",
    "Channel-Lineup",
    "Per-Region",
    "Viewer-Engagement",
    "Device-Types"
]
```
{% endtab %}
{% endtabs %}

## Reports - get report

<mark style="color:blue;">`GET`</mark> `https://admin.serverside.ai/api/v2/systems/:systemid/reports/:report-name`

Get the report name from the 'get reports by system' route above.

#### Path Parameters

| Name         | Type   | Description                  |
| ------------ | ------ | ---------------------------- |
| :systemid    | string | id of relevant system (UUID) |
| :report-name | string | e.g. "Viewing-Time"          |

#### Query Parameters

| Name     | Type   | Description                                 |
| -------- | ------ | ------------------------------------------- |
| start    | number | Start datetime as a number (UNIX timestamp) |
| end      | number | End datetime as a number (UNIX timestamp)   |
| interval | number | Sampling interval in milliseconds           |

{% tabs %}
{% tab title="200 " %}
```
{
    "chartType": "Bar",
    "labels": [
        "'11.",
        "'12.",
        "'13.",
        "'14.",
        "'15.",
        "'16.",
        "'17.",
        "'18.",
        "'19.",
        "'20.",
        "'21.",
        "'22.",
        "'23.",
        "'24.",
        "'25."
    ],
    "series": [
        {
            "name": "Viewing Time Sum",
            "data": [
                58417.43,
                21547.801,
                36662.05,
                22057.06,
                8219.564999999999,
                20154.076,
                11223.451,
                58562.409,
                21852.694,
                21611.001,
                0,
                102.65899999999999,
                95233.44200000001,
                95105.662,
                15863.242
            ]
        }
    ],
    "category": "Viewer Engagement"
}
```
{% endtab %}
{% endtabs %}
