# Clientes

## Endpoints

* ### Lista de clientes por tipo

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

**Método:** GET

**Autenticação:** Basic Auth

**Parâmetros de Consulta:**

| Parâmetro | Tipo   | Obrigatório | Descrição             |
| --------- | ------ | ----------- | --------------------- |
| id        | int    | Não         | ID do tipo de cliente |
| domain    | string | Não         | Domínio do cliente    |
| cnpj      | string | Não         | CNPJ do cliente       |

**Exemplo de retorno:**

```json
{
    "66": {
        "name": "Clima Tempo",
        "type": "Parceiro",
        "domain": "www.climatempo.com.br",
        "cnpj": ""
    },
    "69": {
        "name": "Arcos Dourados",
        "type": "Cliente",
        "domain": "www.mcdonalds.com",
        "cnpj": ""
    },
    "121": {
        "name": "API Customer Updated",
        "type": "Cliente",
        "domain": "apicustomer.com",
        "cnpj": "65.866.698/6815-85"
    }
    
}
```

* ### Lista de tipos de cliente

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

**Método:** GET

**Autenticação:** Basic Auth

**Exemplo de retorno:**

```json
{
    "1": {
        "name": "Cliente"
    },
    "2": {
        "name": "Parceiro"
    },
    "3": {
        "name": "Usuários Extranet"
    }
}
```

* ### Cadastro de clientes

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

**Método:** POST

**Autenticação:** Basic Auth

**Corpo da Requisição:**

| Campo   | Tipo       | Obrigatório | Descrição             |
| ------- | ---------- | ----------- | --------------------- |
| name    | string     | Sim         | Nome do cliente       |
| domain  | string     | Sim         | Site do cliente       |
| type    | int        | Sim         | ID do tipo de cliente |
| address | string     | Não         | Endereço              |
| cpf     | string/int | Não         | CPF                   |
| cnpj    | string/int | Não         | CNPJ                  |

**Exemplo de requisição:**

```postman_json
[
    {
        "name": "Novo Cliente 1",
        "domain": "novocliente1.com.br",
        "type": 1,
        "cnpj": "00.000.000/0000-00"
    },
    {
        "name": "Novo Cliente 2",
        "domain": "novocliente2.com.br",
        "type": 1,
        "cnpj": 11111111111111
    }
]
```

**Exemplo de retorno:**

```json
{
    "successes": [
        {
            "id": "123",
            "name": "Novo Cliente 1"
        },
        {
            "id": "124",
            "name": "Novo Cliente 2"
        }
    ],
    "errors": []
}
```

* ### Edição de clientes

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

**Método:** POST

**Autenticação:** Basic Auth

**Corpo da Requisição:**

| Campo   | Tipo       | Obrigatório | Descrição             |
| ------- | ---------- | ----------- | --------------------- |
| id      | int        | Sim         | ID do cliente         |
| name    | string     | Não         | Nome do cliente       |
| domain  | string     | Não         | Site do cliente       |
| type    | int        | Não         | ID do tipo de cliente |
| address | string     | Não         | Endereço              |
| cpf     | string/int | Não         | CPF                   |
| cnpj    | string/int | Não         | CNPJ                  |

**Exemplo de requisição:**

```postman_json
[
    {
        "id": 123,
        "cnpj": "50.505.505/5050-50",
        "address": "Av. Paulista, 1636"
    }
]
```

**Exemplo de retorno:**

```json
{
    "successes": [
        {
            "id": "123",
            "name": "Novo Cliente 1"
        }
    ],
    "errors": []
}
```


---

# 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/clientes.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.
