# Webhook

## Listar Webhook

<mark style="color:blue;">`GET`</mark> `https://api-v1.assine.online/webhook-business-unit`

Listar todos os webhooks cadastrados.

#### Headers

| Name                                            | Type                   | Description |
| ----------------------------------------------- | ---------------------- | ----------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer \<access-token> |             |
| Content-Type<mark style="color:red;">\*</mark>  | application/json       |             |
| Accept                                          | application/json       |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "_links": {
    "self": {
      "href": "http://localhost/webhook-business-unit?page=1"
    },
    "first": {
      "href": "http://localhost/webhook-business-unit"
    },
    "last": {
      "href": "http://localhost/webhook-business-unit?page=1"
    }
  },
  "_embedded": {
    "webhook_business_unit": [
      {
        "id": 49,
        "url": "https://webhook.site/b2350d9a-5476-425b-bc98-7028fb8f1ee6 Menguin",
        "_embedded": {
          "user": {
            "id": 121,
            "username": "sinesio.leao@soluti.com.br",
            "status": "1",
            "name": "Sinésio Da silva",
            "email": "sinesio.leao@soluti.com.br",
            "position": "vendas",
            "cellphone": "5521967233131",
            "whatsappNumber": "5521967233131",
            "notifyWhatsapp": true,
            "document": null,
            "country": null,
            "state": null,
            "city": null,
            "address": null,
            "zipCode": null,
            "dateCreated": {
              "date": "2021-01-11 22:49:16.000000",
              "timezone_type": 3,
              "timezone": "UTC"
            },
            "dateLastUpdated": {
              "date": "2022-05-09 12:24:12.000000",
              "timezone_type": 3,
              "timezone": "UTC"
            },
            "roleDefault": "admin",
            "_embedded": {
              "businessUnit": {
                "id": 40,
                "name": "Sinésio Luiz",
                "document": "11314553712",
                "status": null,
                "country": null,
                "state": "RJ",
                "city": "São gonçalo",
                "address": "Dr. Porciúncula, 2424",
                "zipCode": "24411006",
                "segmentMarket": "mercado",
                "_links": {
                  "self": {
                    "href": "http://localhost/business-unit/40"
                  }
                }
              }
            },
            "_links": {
              "self": {
                "href": "http://localhost/user/121"
              }
            }
          },
          "businessUnit": {
            "id": 40,
            "name": "Sinésio Luiz",
            "document": "11314553712",
            "_links": {
              "self": {
                "href": "http://localhost/business-unit/40"
              }
            }
          }
        },
        "_links": {
          "self": {
            "href": "http://localhost/webhook-business-unit/49"
          }
        }
      }
    ]
  },
  "page_count": 1,
  "page_size": 25,
  "total_items": 1,
  "page": 1
}
```

{% endtab %}
{% endtabs %}

## Criar Webhook

<mark style="color:green;">`POST`</mark> `https://api-v1.assine.online/webhook-business-unit`

Cadastrar um novo webhook.

#### Headers

| Name                                            | Type                   | Description |
| ----------------------------------------------- | ---------------------- | ----------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer \<access-token> |             |
| Content-Type                                    | application/json       |             |
| Accept                                          | application/json       |             |

#### Request Body

| Name                                           | Type   | Description                      |
| ---------------------------------------------- | ------ | -------------------------------- |
| businessUnit<mark style="color:red;">\*</mark> | String | Id da business unit              |
| url<mark style="color:red;">\*</mark>          | String | Link do webhook a ser cadastrado |

{% tabs %}
{% tab title="201: Created Created" %}

```javascript
{
  "id": 50,
  "url": "https://webhook.site/b2350d9a-5476-425b-bc98-7028fb8f1ee6",
  "_embedded": {
    "user": {
      "id": 121,
      "username": "sinesio.leao@soluti.com.br",
      "password": null,
      "status": "1",
      "name": "Sinésio Da silva",
      "email": "sinesio.leao@soluti.com.br",
      "position": "vendas",
      "cellphone": "5521967233131",
      "whatsappNumber": "5521967233131",
      "notifyWhatsapp": true,
      "document": null,
      "country": null,
      "state": null,
      "city": null,
      "address": null,
      "zipCode": null,
      "dateCreated": {
        "date": "2021-01-11 22:49:16.000000",
        "timezone_type": 3,
        "timezone": "UTC"
      },
      "dateLastUpdated": {
        "date": "2022-05-09 12:24:12.000000",
        "timezone_type": 3,
        "timezone": "UTC"
      },
      "roleDefault": "admin",
      "_embedded": {
        "businessUnit": {
          "id": 40,
          "name": "Sinésio Luiz",
          "document": "11314553712",
          "status": null,
          "country": null,
          "state": "RJ",
          "city": "São gonçalo",
          "address": "Dr. Porciúncula, 2424",
          "zipCode": "24411006",
          "segmentMarket": "mercado",
          "_links": {
            "self": {
              "href": "http://localhost/business-unit/40"
            }
          }
        }
      },
      "_links": {
        "self": {
          "href": "http://localhost/user/121"
        }
      }
    },
    "businessUnit": {
      "id": 40,
      "name": "Sinésio Luiz",
      "document": "11314553712",
      "_links": {
        "self": {
          "href": "http://localhost/business-unit/40"
        }
      }
    }
  },
  "_links": {
    "self": {
      "href": "http://localhost/webhook-business-unit/50"
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Atualizar webhook

<mark style="color:purple;">`PATCH`</mark> `https://api-v1.assine.online/webhook-business-unit/1`

Realizar alterações em webhooks previamente cadastrados.

#### Headers

| Name                                            | Type   | Description            |
| ----------------------------------------------- | ------ | ---------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer \<access-token> |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json       |
| Accept<mark style="color:red;">\*</mark>        | string | application/json       |

#### Request Body

| Name                                  | Type   | Description                    |
| ------------------------------------- | ------ | ------------------------------ |
| url<mark style="color:red;">\*</mark> | string | Link do webhook a ser alterado |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "id": 1,
  "url": "https://webhook.site/b2350d9a-5476-425b-bc98-7028fb8f1ee6000",
  "_embedded": {
    "user": {
      "id": 121,
      "username": "sinesio.leao@soluti.com.br",
      "status": "1",
      "name": "Sinésio Da silva",
      "email": "sinesio.leao@soluti.com.br",
      "position": "vendas",
      "cellphone": "5521967233131",
      "whatsappNumber": "5521967233131",
      "notifyWhatsapp": true,
      "document": null,
      "country": null,
      "state": null,
      "city": null,
      "address": null,
      "zipCode": null,
      "dateCreated": {
        "date": "2021-01-11 22:49:16.000000",
        "timezone_type": 3,
        "timezone": "UTC"
      },
      "dateLastUpdated": {
        "date": "2022-05-09 12:24:12.000000",
        "timezone_type": 3,
        "timezone": "UTC"
      },
      "roleDefault": "admin",
      "_embedded": {
        "businessUnit": {
          "id": 40,
          "name": "Sinésio Luiz",
          "document": "11314553712",
          "status": null,
          "country": null,
          "state": "RJ",
          "city": "São gonçalo",
          "address": "Dr. Porciúncula, 2424",
          "zipCode": "24411006",
          "_links": {
            "self": {
              "href": "http://localhost/business-unit/1"
            }
          }
        }
      },
      "_links": {
        "self": {
          "href": "http://localhost/user/121"
        }
      }
    },
    "businessUnit": {
      "id": 40,
      "name": "Sinésio Luiz",
      "document": "11314553712",
      "status": null,
      "country": null,
      "state": "RJ",
      "city": "São gonçalo",
      "address": "Dr. Porciúncula, 2424",
      "zipCode": "24411006",
      "_links": {
        "self": {
          "href": "http://localhost/business-unit/1"
        }
      }
    }
  },
  "_links": {
    "self": {
      "href": "http://localhost/webhook-business-unit/1"
    }
  }
}
```

{% endtab %}
{% endtabs %}

## Remover webhook

<mark style="color:red;">`DELETE`</mark> `https://api-v1.assine.online/webhook-business-unit/1`

Remover um webhook

#### Headers

| Name                                            | Type   | Description            |
| ----------------------------------------------- | ------ | ---------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer \<access-token> |
| Content-Type<mark style="color:red;">\*</mark>  | string | application/json       |
| Accept<mark style="color:red;">\*</mark>        | string | application/json       |

{% tabs %}
{% tab title="204: No Content " %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}


---

# 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://docs.assine.online/api/api/webhook.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.
