# Mídias

## Endpoints

* ### Lista de mídias

**URL:** \<seuprojeto>.edgecontents.com/ds/api/media

**Método:** GET

**Autenticação:** Basic Auth

**Parâmetros de Consulta:**

<table><thead><tr><th>Parâmetro</th><th width="187">Tipo</th><th>Descrição</th></tr></thead><tbody><tr><td>id</td><td>int</td><td>ID do cliente</td></tr><tr><td>domain</td><td>text</td><td>Domínio do cliente</td></tr><tr><td>cnpj</td><td>text</td><td>CNPJ do cliente</td></tr><tr><td>campaign</td><td>int</td><td>ID da campanha</td></tr></tbody></table>

**Obs**: ao menos um dos parâmetros é necessário para consulta.

**Exemplo de retorno:**

```json
{
    "1": {
        "name": "climatempo_responsivo_10s_16x9",
        "screen_format_id": 2,
        "screen_format": "672x336",
        "duration": "00:00:10",
        "campaign_id": 10
    },
    "6": {
        "name": "climatempo_responsivo_10s_v2",
        "screen_format_id": 5,
        "screen_format": "1080x360",
        "duration": "00:00:10",
        "campaign_id": null
    }
}
```

* ### Cadastro de mídia

**URL:** \<seuprojeto>.edgecontents.com/ds/api/media/add

**Método:** POST

**Autenticação:** Basic Auth

**Corpo da Requisição (form-data):**

| Campo        | Tipo | Obrigatório | Descrição          |
| ------------ | ---- | ----------- | ------------------ |
| title        | Text | Sim         | Nome da mídia      |
| customer     | Text | Sim         | ID do cliente      |
| campaign     | Text | Sim         | ID da campanha     |
| screenformat | Text | Sim         | Formato de tela    |
| duration     | Text | Não         | Duração            |
| file         | File | -           | Caminho do arquivo |
| file\_url    | Text | -           | URL da mídia       |

**Exemplo de requisição com file:**

```postman_json
curl --location '<seuprojeto>.edgecontents.com/ds/api/media/add' \
--header 'Authorization: ••••••' \
--header 'Cookie: PHPSESSID=57a6umud56v0e4a' \
--form 'file=@"/C:/Users/lalca/Desktop/arquivo.png"' \
--form 'customer="1"' \
--form 'campaign="30"' \
--form 'title="Mídia Exemplo"' \
--form 'screenformat="12"'
```

**Exemplo de requisição com file\_url:**

```
curl --location '<seuprojeto>.edgecontents.com/ds/api/media/add' \
--header 'Authorization: ••••••' \
--header 'Cookie: PHPSESSID=57a6umud56v0e4a' \
--form 'file_url="https://images.com/img/2022/11/18/10-segundos-horizontal.mp4"' \
--form 'customer="1"' \
--form 'campaign="30"' \
--form 'title="Mídia Exemplo"' \
--form 'screenformat="12"'
```

**Exemplo de retorno:**

```json
{
    "successes": [
        {
            "id": "319",
            "name": "Mídia Exemplo"
        }
    ],
    "errors": []
}
```

* ### Edição de mídia

**URL:** \<seuprojeto>.edgecontents.com/ds/api/media/update

**Método:** POST

**Autenticação:** Basic Auth

**Corpo da Requisição (form-data):**

| Campo        | Tipo | Obrigatório | Descrição          |
| ------------ | ---- | ----------- | ------------------ |
| id           | Text | Sim         | ID da mídia        |
| title        | Text | Não         | Nome da mídia      |
| screenformat | Text | Não         | Formato de tela    |
| duration     | Text | Não         | Duração            |
| file         | File | Não         | Caminho do arquivo |

**Exemplo de requisição:**

```postman_json
curl --location '<seuprojeto>.edgecontents.com/ds/api/media/update' \
--header 'Authorization: ••••••' \
--header 'Cookie: PHPSESSID=57a6umud56v0e4a' \
--form 'id="319"' \
--form 'title="Mídia Exemplo Atualização"'
```

**Exemplo de retorno:**

```json
{
    "successes": [
        {
            "id": "319",
            "name": "Mídia Exemplo Atualização"
        }
    ],
    "errors": []
}
```

* ### Lista de publicação

**URL:** \<seuprojeto>.edgecontents.com/ds/api/media/publication

**Método:** GET

**Autenticação:** Basic Auth

**Parâmetros de Consulta:**

| Campo | Tipo | Obrigatório | Descrição   |
| ----- | ---- | ----------- | ----------- |
| id    | Text | Sim         | ID da mídia |

**Exemplo de retorno:**

```json
{
    "name": "43498-unilever-brasil-maizena-2160x3840_n68n6j_default",
    "screen_format_id": 12,
    "customer_id": 28,
    "campaign_id": 31,
    "playlistitems": [
        {
            "playlist_id": 267,
            "playlist_name": "Comercial - 5",
            "start": "2026-01-26 09:55:49",
            "end": null,
            "allscreens": 0,
            "screens": [
                {
                    "id": 14,
                    "name": "PC UBUNTU 24.04"
                },
                {
                    "id": 6,
                    "name": "TV Entrada"
                },
            ],
            "sites": [],
            "groups": []
        }
    ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.edgecontents.com/edgecontents/apis/midias.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
