Webhook#

get_webhook#

コードサンプル

#  You can also use wget

curl -X GET https://PEM-SERVER-IP/api/v14/webhook/ \
  -H Accept: application/json \
  -H X-Auth-Token: string
import requests
headers = {
  Accept: application/json,
  X-Auth-Token: string
}

r = requests.get(https://PEM-SERVER-IP/api/v14/webhook/, headers = headers)

print(r.json())
const headers = {
  Accept:application/json,
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v14/webhook/,
{
  method: GET,

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /webhook/

Webhookリストを取得します。

パラメーター#

Name

In

Type

Required

Description

X-Auth-Token

header

string

true

承認トークン

応答例

[
  {
    "id": 0,
    "name": "string",
    "url": "string",
    "enabled": true,
    "method": "POST",
    "http_headers": [
      {
        "http_header_id": 0,
        "http_header_key": "string",
        "http_header_value": "string"
      }
    ],
    "payload_template": "{text: You have new alert from PEM, attachments: [{text: AlertID \n%AlertID% \nAlertName \n%AlertName%}]}",
    "low_alert": true,
    "med_alert": true,
    "high_alert": true,
    "cleared_alert": true,
    "payload_type": "ALERT"
  }
]

応答#

Status

Meaning

Description

Schema

200

コマンドラインからのサーバーインストーラーの呼び出し

ステータス200

Inline

レスポンススキーマ#

ステータスコード 200

Name

Type

Required

Restrictions

Description

anonymous

Query information ]

false

none

なし

» id

integer

false

none

Webhook ID

» name

string

false

none

Webhook名

» url

string

false

none

Webhook URL

» enabled

boolean

false

none

Webhookが有効になっているかどうかを判断します。

» method

string

false

none

リクエストメソッド

» http_headers

Query information ]

false

none

Webhookで使用されるHTTPヘッダーのキー/値ペアのリスト

»» http_header_id

integer

false

none

HTTPヘッダーのID

»» http_header_key

string

false

none

HTTPヘッダーキーの名前

»» http_header_value

string

false

none

HTTPヘッダーキーの名前

» payload_template

string

false

none

ペイロードテンプレート。以下は、Slackのペイロードの例です。

» low_alert

boolean

false

none

低アラートを有効にするかどうかを決定します。

» med_alert

boolean

false

none

中程度のアラートを有効にするかどうかを決定します。

» high_alert

boolean

false

none

厳重なアラートを有効にするかどうかを決定します。

» cleared_alert

boolean

false

none

クリアされたアラートが有効かどうかを判断します。

» payload_type

string

false

none

ペイロードタイプ

列挙値#

Property

Value

method

POST

method

PUT

payload_type

ALERT

payload_type

JOB

注釈

この操作には認証が必要ありません

post_webhook#

コードサンプル

#  You can also use wget

curl -X POST https://PEM-SERVER-IP/api/v14/webhook/ \
  -H Content-Type: application/json \
  -H X-Auth-Token: string
import requests
headers = {
  Content-Type: application/json,
  X-Auth-Token: string
}

r = requests.post(https://PEM-SERVER-IP/api/v14/webhook/, headers = headers)

print(r.json())
const inputBody = {
  "name": "string",
  "url": "string",
  "enabled": true,
  "method": "POST",
  "http_headers": [
    {
      "http_header_key": "string",
      "http_header_value": "string"
    }
  ],
  "payload_template": "{ Alert Name:%AlertName%,type:Webhook }",
  "low_alert": true,
  "med_alert": true,
  "high_alert": true,
  "cleared_alert": true,
  "payload_type": "ALERT"
};
const headers = {
  Content-Type:application/json,
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v14/webhook/,
{
  method: POST,
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

POST /webhook/

新しいWebhookを追加します。

ボディパラメーター

{
  "name": "string",
  "url": "string",
  "enabled": true,
  "method": "POST",
  "http_headers": [
    {
      "http_header_key": "string",
      "http_header_value": "string"
    }
  ],
  "payload_template": "{ Alert Name:%AlertName%,type:Webhook }",
  "low_alert": true,
  "med_alert": true,
  "high_alert": true,
  "cleared_alert": true,
  "payload_type": "ALERT"
}

パラメーター#

Name

In

Type

Required

Description

X-Auth-Token

header

string

true

承認トークン

body

body

WebhookPostData

true

なし

応答例

応答#

Status

Meaning

Description

Schema

200

コマンドラインからのサーバーインストーラーの呼び出し

Webhookが正常に作成されました。

None

レスポンススキーマ#

注釈

この操作には認証が必要ありません

get_webhook{webhook_id}#

コードサンプル

#  You can also use wget

curl -X GET https://PEM-SERVER-IP/api/v14/webhook/{webhook_id} \
  -H Accept: application/json \
  -H X-Auth-Token: string
import requests
headers = {
  Accept: application/json,
  X-Auth-Token: string
}

r = requests.get(https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}, headers = headers)

print(r.json())
const headers = {
  Accept:application/json,
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v14/webhook/{webhook_id},
{
  method: GET,

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

GET /webhook/{webhook_id}

webhook_idで識別されるWebhookの情報を取得します。

パラメーター#

Name

In

Type

Required

Description

webhook_id

path

string

true

なし

X-Auth-Token

header

string

true

承認トークン

応答例

{
  "id": 0,
  "name": "string",
  "url": "string",
  "enabled": true,
  "method": "POST",
  "http_headers": [
    {
      "http_header_id": 0,
      "http_header_key": "string",
      "http_header_value": "string"
    }
  ],
  "payload_template": "{text: You have new alert from PEM, attachments: [{text: AlertID \n%AlertID% \nAlertName \n%AlertName%}]}",
  "low_alert": true,
  "med_alert": true,
  "high_alert": true,
  "cleared_alert": true,
  "payload_type": "ALERT"
}

応答#

Status

Meaning

Description

Schema

200

コマンドラインからのサーバーインストーラーの呼び出し

ステータス200

Webhook

注釈

この操作には認証が必要ありません

put_webhook{webhook_id}#

コードサンプル

#  You can also use wget

curl -X PUT https://PEM-SERVER-IP/api/v14/webhook/{webhook_id} \
  -H Content-Type: application/json \
  -H X-Auth-Token: string
import requests
headers = {
  Content-Type: application/json,
  X-Auth-Token: string
}

r = requests.put(https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}, headers = headers)

print(r.json())
const inputBody = {
  "name": "string",
  "url": "string",
  "enabled": true,
  "method": "POST",
  "http_headers": {
    "added": [
      {
        "http_header_key": "string",
        "http_header_value": "string"
      }
    ],
    "changed": [
      {
        "http_header_id": 0,
        "http_header_key": "string",
        "http_header_value": "string"
      }
    ],
    "deleted": [
      {
        "http_header_id": 0
      }
    ],
    "payload_type": "ALERT"
  },
  "payload_template": "{text: You have new alert from PEM, attachments: [{text: AlertID \n%AlertID% \nAlertName \n%AlertName%}]}",
  "low_alert": true,
  "med_alert": true,
  "high_alert": true,
  "cleared_alert": true
};
const headers = {
  Content-Type:application/json,
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v14/webhook/{webhook_id},
{
  method: PUT,
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

PUT /webhook/{webhook_id}

Webhook情報を更新します。

ボディパラメーター

{
  "name": "string",
  "url": "string",
  "enabled": true,
  "method": "POST",
  "http_headers": {
    "added": [
      {
        "http_header_key": "string",
        "http_header_value": "string"
      }
    ],
    "changed": [
      {
        "http_header_id": 0,
        "http_header_key": "string",
        "http_header_value": "string"
      }
    ],
    "deleted": [
      {
        "http_header_id": 0
      }
    ],
    "payload_type": "ALERT"
  },
  "payload_template": "{text: You have new alert from PEM, attachments: [{text: AlertID \n%AlertID% \nAlertName \n%AlertName%}]}",
  "low_alert": true,
  "med_alert": true,
  "high_alert": true,
  "cleared_alert": true
}

パラメーター#

Name

In

Type

Required

Description

webhook_id

path

string

true

なし

X-Auth-Token

header

string

true

承認トークン

body

body

WebhookPutData

true

なし

応答例

応答#

Status

Meaning

Description

Schema

200

コマンドラインからのサーバーインストーラーの呼び出し

Webhookが正常に更新されました。

None

レスポンススキーマ#

注釈

この操作には認証が必要ありません

delete_webhook{webhook_id}#

コードサンプル

#  You can also use wget

curl -X DELETE https://PEM-SERVER-IP/api/v14/webhook/{webhook_id} \
  -H X-Auth-Token: string
import requests
headers = {
  X-Auth-Token: string
}

r = requests.delete(https://PEM-SERVER-IP/api/v14/webhook/{webhook_id}, headers = headers)

print(r.json())
const headers = {
  X-Auth-Token:string
};

fetch(https://PEM-SERVER-IP/api/v14/webhook/{webhook_id},
{
  method: DELETE,

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

DELETE /webhook/{webhook_id}

Webhookを削除します。

パラメーター#

Name

In

Type

Required

Description

webhook_id

path

string

true

なし

X-Auth-Token

header

string

true

承認トークン

応答例

応答#

Status

Meaning

Description

Schema

200

コマンドラインからのサーバーインストーラーの呼び出し

Webhookは正常に削除されました

None

レスポンススキーマ#

注釈

この操作には認証が必要ありません