# Webhook

> **Package : spaceone.api.monitoring.v1**

## Webhook

{% hint style="info" %}
**Webhook Methods:**
{% endhint %}

| Method                               | Request                                                   | Response                                                                                                           |
| ------------------------------------ | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create)                | [CreateWebhookRequest](#createwebhookrequest)             | [WebhookInfo](#webhookinfo)                                                                                        |
| [**update**](#update)                | [UpdateWebhookRequest](#updatewebhookrequest)             | [WebhookInfo](#webhookinfo)                                                                                        |
| [**update\_plugin**](#update_plugin) | [UpdateWebhookPluginRequest](#updatewebhookpluginrequest) | [WebhookInfo](#webhookinfo)                                                                                        |
| [**verify\_plugin**](#verify_plugin) | [WebhookRequest](#webhookrequest)                         | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**enable**](#enable)                | [WebhookRequest](#webhookrequest)                         | [WebhookInfo](#webhookinfo)                                                                                        |
| [**disable**](#disable)              | [WebhookRequest](#webhookrequest)                         | [WebhookInfo](#webhookinfo)                                                                                        |
| [**delete**](#delete)                | [WebhookRequest](#webhookrequest)                         | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)                      | [GetWebhookRequest](#getwebhookrequest)                   | [WebhookInfo](#webhookinfo)                                                                                        |
| [**list**](#list)                    | [WebhookQuery](#webhookquery)                             | [WebhooksInfo](#webhooksinfo)                                                                                      |
| [**stat**](#stat)                    | [WebhookStatQuery](#webhookstatquery)                     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /monitoring/v1/webhooks

> Creates a new Webhook. A Webhook collects data from an external monitoring system with a webhook URL generated by the resource.

| Type     | Message                                       |
| -------- | --------------------------------------------- |
| Request  | [CreateWebhookRequest](#createwebhookrequest) |
| Response | [WebhookInfo](#webhookinfo)                   |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "name": "aws-sns-webhook-for-phd",
    "plugin_info": {
        "plugin_id": "plugin-aws-sns-mon-webhook",
        "options": {}
    },
    "project_id": "project-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "name": "aws-sns-webhook-for-phd",
    "state": "ENABLED",
    "access_key": "1234567890123456789012345678901",
    "webhook_url": "https://spaceone.dev/monitoring/v1/webhook/webhook-123456789012/1234567890123456789012345678901/events",
    "capability": {},
    "plugin_info": {
        "plugin_id": "plugin-aws-sns-mon-webhook",
        "version": "1.2.2",
        "options": {},
        "metadata": {},
        "upgrade_mode": "AUTO"
    },
    "project_id": "project-123456789012",
    "domain_id": "domain-123456789012",
    "created_at": "2022-01-01T07:23:33.875Z"
}
```

{% endtab %}
{% endtabs %}

### update

> **PUT** /monitoring/v1/webhook/{webhook\_id}

> Updates a specific Webhook. You can make changes in Webhook settings, including the name and tags.

| Type     | Message                                       |
| -------- | --------------------------------------------- |
| Request  | [UpdateWebhookRequest](#updatewebhookrequest) |
| Response | [WebhookInfo](#webhookinfo)                   |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "name": "aws-sns-webhook-for-cloudwatch",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "name": "aws-sns-webhook-for-cloudwatch",
    "state": "ENABLED",
    "access_key": "1234567890123456789012345678901",
    "webhook_url": "https://spaceone.dev/monitoring/v1/webhook/webhook-123456789012/1234567890123456789012345678901/events",
    "capability": {},
    "plugin_info": {
        "plugin_id": "plugin-aws-sns-mon-webhook",
        "version": "1.2.2",
        "options": {},
        "metadata": {},
        "upgrade_mode": "AUTO"
    },
    "project_id": "project-123456789012",
    "domain_id": "domain-123456789012",
    "created_at": "2022-01-01T07:23:33.875Z"
}
```

{% endtab %}
{% endtabs %}

### update\_plugin

> **PUT** /monitoring/v1/webhook/{webhook\_id}/plugin

| Type     | Message                                                   |
| -------- | --------------------------------------------------------- |
| Request  | [UpdateWebhookPluginRequest](#updatewebhookpluginrequest) |
| Response | [WebhookInfo](#webhookinfo)                               |

### verify\_plugin

> **POST** /monitoring/v1/webhook/{webhook\_id}/plugin/verify

> Verifies a specific plugin for a Webhook.

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [WebhookRequest](#webhookrequest)                                                                                |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}
{% endtabs %}

### enable

> **PUT** /monitoring/v1/webhook/{webhook\_id}/enable

> Enables a specific Webhook. By enabling a Webhook, you can communicate with an external application.

| Type     | Message                           |
| -------- | --------------------------------- |
| Request  | [WebhookRequest](#webhookrequest) |
| Response | [WebhookInfo](#webhookinfo)       |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "name": "aws-sns-webhook-for-cloudwatch",
    "state": "ENABLED",
    "access_key": "1234567890123456789012345678901",
    "webhook_url": "https://monitoring-webhook.dev.spaceone.dev/monitoring/v1/webhook/webhook-123456789012/1234567890123456789012345678901/events",
    "capability": {},
    "plugin_info": {
        "plugin_id": "plugin-aws-sns-mon-webhook",
        "version": "1.2.2",
        "options": {},
        "metadata": {},
        "upgrade_mode": "AUTO"
    },
    "project_id": "project-123456789012",
    "domain_id": "domain-123456789012",
    "created_at": "2022-01-01T07:23:33.875Z"
}
```

{% endtab %}
{% endtabs %}

### disable

> **PUT** /monitoring/v1/webhook/{webhook\_id}/disable

> Disables a specific Webhook. By disabling a Webhook, you cannot communicate with an external application, as the webhook URL from the Webhook becomes invalid.

| Type     | Message                           |
| -------- | --------------------------------- |
| Request  | [WebhookRequest](#webhookrequest) |
| Response | [WebhookInfo](#webhookinfo)       |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "name": "aws-sns-webhook-for-cloudwatch",
    "state": "DISABLED",
    "access_key": "1234567890123456789012345678901",
    "webhook_url": "https://monitoring-webhook.dev.spaceone.dev/monitoring/v1/webhook/webhook-123456789012/1234567890123456789012345678901/events",
    "capability": {},
    "plugin_info": {
        "plugin_id": "plugin-aws-sns-mon-webhook",
        "version": "1.2.2",
        "options": {},
        "metadata": {},
        "upgrade_mode": "AUTO"
    },
    "project_id": "project-123456789012",
    "domain_id": "domain-123456789012",
    "created_at": "2022-01-01T07:23:33.875Z"
}
```

{% endtab %}
{% endtabs %}

### delete

> **DELETE** /monitoring/v1/webhook/{webhook\_id}

> Deletes a specific Webhook. By deleting a Webhook, you cannot collect data from an external monitoring system, as the `REST URL` is also deleted.

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [WebhookRequest](#webhookrequest)                                                                                |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}
{% endtabs %}

### get

> **GET** /monitoring/v1/webhook/{webhook\_id}

> Gets a specific Webhook. Prints detailed information about the Webhook, including the name, the version, and the created datetime.

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [GetWebhookRequest](#getwebhookrequest) |
| Response | [WebhookInfo](#webhookinfo)             |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "webhook_id": "webhook-123456789012",
    "name": "aws-sns-webhook-for-cloudwatch",
    "state": "ENABLED",
    "access_key": "1234567890123456789012345678901",
    "webhook_url": "https://monitoring-webhook.dev.spaceone.dev/monitoring/v1/webhook/webhook-123456789012/1234567890123456789012345678901/events",
    "capability": {},
    "plugin_info": {
        "plugin_id": "plugin-aws-sns-mon-webhook",
        "version": "1.2.2",
        "options": {},
        "metadata": {},
        "upgrade_mode": "AUTO"
    },
    "project_id": "project-123456789012",
    "domain_id": "domain-123456789012",
    "created_at": "2022-01-01T07:23:33.875Z"
}
```

{% endtab %}
{% endtabs %}

### list

> **GET** /monitoring/v1/webhooks
>
> **POST** /monitoring/v1/webhooks/search

> Gets a list of all Webhooks. You can use a query to get a filtered list of Webhooks.

| Type     | Message                       |
| -------- | ----------------------------- |
| Request  | [WebhookQuery](#webhookquery) |
| Response | [WebhooksInfo](#webhooksinfo) |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "query": {},
    "project_id": "project-123456789012",
    "domain_id": "domain-123456789012"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "results": [
        {
            "webhook_id": "webhook-123456789012",
            "name": "aws-sns-webhook-for-cloudwatch",
            "state": "ENABLED",
            "access_key": "1234567890123456789012345678901",
            "webhook_url": "https://monitoring-webhook.dev.spaceone.dev/monitoring/v1/webhook/webhook-123456789012/1234567890123456789012345678901/events",
            "capability": {},
            "plugin_info": {
                "plugin_id": "plugin-aws-sns-mon-webhook",
                "version": "1.2.2",
                "options": {},
                "metadata": {},
                "upgrade_mode": "AUTO"
            },
            "project_id": "project-123456789012",
            "domain_id": "domain-123456789012",
            "created_at": "2022-01-01T07:23:33.875Z"
        },
        {
            "webhook_id": "webhook-987654321098",
            "name": "zabbix-webhook",
            "state": "ENABLED",
            "access_key": "9876567890123456789012345678901",
            "webhook_url": "https://monitoring-webhook.dev.spaceone.dev/monitoring/v1/webhook/webhook-987654321098/9876567890123456789012345678901/events",
            "capability": {},
            "plugin_info": {
                "plugin_id": "plugin-zabbix-mon-webhook",
                "version": "1.0",
                "options": {},
                "metadata": {},
                "upgrade_mode": "AUTO"
            },
            "project_id": "project-123456789012",
            "domain_id": "domain-123456789012",
            "created_at": "2022-01-01T07:42:31.872Z"
        }
    ],
    "total_count": 2
}
```

{% endtab %}
{% endtabs %}

### stat

> **POST** /monitoring/v1/webhooks/stat

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [WebhookStatQuery](#webhookstatquery)                                                                              |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

##

## Message

### CreateWebhookRequest

| Field        | Type                                                                                                               | Required | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| name         | string                                                                                                             |     ✔    |             |
| plugin\_info | [WebhookPluginInfo](#webhookplugininfo)                                                                            |     ✔    |             |
| tags         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| project\_id  | string                                                                                                             |     ✔    |             |
| domain\_id   | string                                                                                                             |     ✔    |             |

### GetWebhookRequest

| Field       | Type           | Required | Description |
| ----------- | -------------- | :------: | ----------- |
| webhook\_id | string         |     ✔    |             |
| domain\_id  | string         |     ✔    |             |
| only        | list of string |     ✘    |             |

### UpdateWebhookPluginRequest

| Field         | Type                                                                                                               | Required | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | -------- | ----------- |
| webhook\_id   | string                                                                                                             | ✔        |             |
| version       | string                                                                                                             | ✘        |             |
| options       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) | ✘        |             |
| upgrade\_mode | <ul><li>NONE</li><li>MANUAL</li><li>AUTO</li></ul>                                                                 | ✘        |             |
| domain\_id    | string                                                                                                             | ✔        |             |

### UpdateWebhookRequest

| Field       | Type                                                                                                               | Required | Description |
| ----------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| webhook\_id | string                                                                                                             |     ✔    |             |
| name        | string                                                                                                             |     ✘    |             |
| tags        | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| domain\_id  | string                                                                                                             |     ✔    |             |

### WebhookInfo

| Field        | Type                                                                                                               | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| webhook\_id  | string                                                                                                             |             |
| name         | string                                                                                                             |             |
| state        | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li></ul>                                                            |             |
| access\_key  | string                                                                                                             |             |
| webhook\_url | string                                                                                                             |             |
| capability   | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| plugin\_info | [WebhookPluginInfo](#webhookplugininfo)                                                                            |             |
| tags         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| project\_id  | string                                                                                                             |             |
| domain\_id   | string                                                                                                             |             |
| created\_at  | string                                                                                                             |             |

### WebhookPluginInfo

| Field         | Type                                                                                                               | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| plugin\_id    | string                                                                                                             |             |
| version       | string                                                                                                             |             |
| options       | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| metadata      | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| upgrade\_mode | <ul><li>NONE</li><li>MANUAL</li><li>AUTO</li></ul>                                                                 |             |

### WebhookQuery

| Field        | Type                                                                                               | Required | Description |
| ------------ | -------------------------------------------------------------------------------------------------- | -------- | ----------- |
| query        | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ✘        |             |
| webhook\_id  | string                                                                                             | ✘        |             |
| name         | string                                                                                             | ✘        |             |
| state        | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li></ul>                                            | ✘        |             |
| access\_key  | string                                                                                             | ✘        |             |
| webhook\_url | string                                                                                             | ✘        |             |
| project\_id  | string                                                                                             | ✘        |             |
| domain\_id   | string                                                                                             | ✔        |             |

### WebhookRequest

| Field       | Type   | Required | Description |
| ----------- | ------ | :------: | ----------- |
| webhook\_id | string |     ✔    |             |
| domain\_id  | string |     ✔    |             |

### WebhookStatQuery

| Field      | Type                                                                                                             | Required | Description |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) |     ✔    |             |
| domain\_id | string                                                                                                           |     ✔    |             |

### WebhooksInfo

| Field        | Type                                                                                            | Description |
| ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| results      | [list of WebhookInfo](#webhookinfo)                                                             |             |
| total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |
