# Ads

### Stream Ads

<mark style="color:blue;">`GET`</mark> `http://api.komoverse.dev/v2/stream-ads`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| x-api-key<mark style="color:red;">\*</mark>     | String | Api key      |
| Authorization<mark style="color:red;">\*</mark> | Bearer | Token bearer |

{% tabs %}
{% tab title="200: OK Successfull Showing List Ads" %}

```json
{
    "status": "Success",
    "data": [
        {
            "title_ads": "One Heart",
            "business_name": "Honda",
            "website_ads": "https://www.astra-honda.com/",
            "target_country_ads": [
                "AFG",
                "ARG",
                "AUS"
            ],
            "id_ads": "3a80a5792c584ec1a1016019de33957b",
            "cloudflare_watch_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/3a80a5792c584ec1a1016019de33957b/watch",
            "cloudflare_hls_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/3a80a5792c584ec1a1016019de33957b/manifest/video.m3u8",
            "cloudflare_dash_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/3a80a5792c584ec1a1016019de33957b/manifest/video.mpd",
            "cloudflare_mp4_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/3a80a5792c584ec1a1016019de33957b/downloads/default.mp4"
        },
        {
            "title_ads": "Iphone 14 Pro",
            "business_name": "Apple",
            "website_ads": "https://www.apple.com/",
            "target_country_ads": [
                "AFG",
                "ARG",
                "AUS",
                "IDN",
                "PHL"
            ],
            "id_ads": "035831e9a68b42629d57e0f18ed35d3c",
            "cloudflare_watch_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/035831e9a68b42629d57e0f18ed35d3c/watch",
            "cloudflare_hls_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/035831e9a68b42629d57e0f18ed35d3c/manifest/video.m3u8",
            "cloudflare_dash_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/035831e9a68b42629d57e0f18ed35d3c/manifest/video.mpd",
            "cloudflare_mp4_api": "https://customer-0of4q484a82jyq4e.cloudflarestream.com/035831e9a68b42629d57e0f18ed35d3c/downloads/default.mp4"
        }
    ]
}
```

{% endtab %}

{% tab title="403: Forbidden Error not fill x-api-key" %}

```json
{
    "status": "error",
    "messages": {
        "apiKeyRequired": "An API key is required to perform this request. If you wish to use the KOMO API in your application, contact the Komoverse team to reach out for an agreement."
    }
}
```

{% endtab %}

{% tab title="403: Forbidden Error not fill authorization bearer token" %}

```json
{
    "status": "error",
    "messages": {
        "tokenRequired": "A login token is required to perform this request."
    }
}
```

{% endtab %}
{% endtabs %}

### Update Click and Views Ads

<mark style="color:orange;">`PUT`</mark> `http://api.komoverse.dev/v2/stream-ads/{id_ads}`

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| x-api-key<mark style="color:red;">\*</mark>     | String | API key      |
| Authorization<mark style="color:red;">\*</mark> | Bearer | Bearer Token |

#### Request Body

| Name                                    | Type    | Description  |
| --------------------------------------- | ------- | ------------ |
| views<mark style="color:red;">\*</mark> | Integer | Number views |
| click<mark style="color:red;">\*</mark> | Integer | Number click |

{% tabs %}
{% tab title="201: Created Successfully update click and views" %}

```json
{
    "message": "Update Ads Successfully!",
    "status": "success"
}
```

{% endtab %}

{% tab title="400: Bad Request Missing a body request" %}

```json
{
    "status": "error",
    "message": {
        "views": [
            "The views field is required."
        ],
        "click": [
            "The click field is required."
        ]
    }
}
```

{% endtab %}
{% endtabs %}
