Webhook#
get_webhook#
コードサンプル
# You can also use wget
curl -X GET https://PEM-SERVER-IP/pem/api/v17/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/pem/api/v17/webhook/, headers = headers)
print(r.json())
const headers = {
Accept: "application/json",
"X-Auth-Token": "string",
};
fetch("https://PEM-SERVER-IP/pem/api/v17/webhook/", {
method: "GET",
headers: headers,
})
.then(function (res) {
return res.json();
})
.then(function (body) {
console.log(body);
});
GET /webhook/
Webhookリストを取得します。
Webhookのリストを返します。 name 完全一致またはname_contains
部分文字列検索クエリパラメーターを介してオプションの名前ベースのフィルタリングをサポートします。
パラメーター#
Name |
In |
Type |
Required |
Description |
|---|---|---|---|---|
X-Auth-Token |
header |
string |
true |
承認トークン |
name |
query |
string |
false |
完全な名前の一致大文字と小文字を区別してWebhookをフィルタリングします。 name_containsと相互排他的。 |
name_contains |
query |
string |
false |
部分文字列の一致大文字と小文字を区別してWebhookをフィルタリングします。 nameと相互排他的。 |
応答例
[
{
"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 |
|
400 |
相互排他性違反 `name`または類似の完全一致フィルタと`name_contains`または類似の部分文字列フィルタが両方とも同じ要求で指定されました。フィルタリングは、ペアのうちの1つのみを受け入れます。 |
Inline |
レスポンススキーマ#
ステータスコード 200
Name |
Type |
Required |
Restrictions |
Description |
|---|---|---|---|---|
_anonymous_ |
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 |
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 |
ステータスコード 400
Name |
Type |
Required |
Restrictions |
Description |
|---|---|---|---|---|
» success |
integer |
false |
none |
なし |
» errormsg |
string |
false |
none |
なし |
注釈
この操作には認証が必要ありません
post_webhook#
コードサンプル
# You can also use wget
curl -X POST https://PEM-SERVER-IP/pem/api/v17/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/pem/api/v17/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/pem/api/v17/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 |
true |
なし |
応答例
応答#
Status |
Meaning |
Description |
Schema |
|---|---|---|---|
200 |
Webhookが正常に作成されました。 |
None |
レスポンススキーマ#
注釈
この操作には認証が必要ありません
get_webhook{webhook_id}#
コードサンプル
# You can also use wget
curl -X GET https://PEM-SERVER-IP/pem/api/v17/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/pem/api/v17/webhook/{webhook_id}, headers = headers)
print(r.json())
const headers = {
Accept: "application/json",
"X-Auth-Token": "string",
};
fetch("https://PEM-SERVER-IP/pem/api/v17/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 |
注釈
この操作には認証が必要ありません
put_webhook{webhook_id}#
コードサンプル
# You can also use wget
curl -X PUT https://PEM-SERVER-IP/pem/api/v17/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/pem/api/v17/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/pem/api/v17/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 |
true |
なし |
応答例
応答#
Status |
Meaning |
Description |
Schema |
|---|---|---|---|
200 |
Webhookが正常に更新されました。 |
None |
レスポンススキーマ#
注釈
この操作には認証が必要ありません
delete_webhook{webhook_id}#
コードサンプル
# You can also use wget
curl -X DELETE https://PEM-SERVER-IP/pem/api/v17/webhook/{webhook_id} \
-H X-Auth-Token: string
import requests
headers = {
X-Auth-Token: string
}
r = requests.delete(https://PEM-SERVER-IP/pem/api/v17/webhook/{webhook_id}, headers = headers)
print(r.json())
const headers = {
"X-Auth-Token": "string",
};
fetch("https://PEM-SERVER-IP/pem/api/v17/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 |
レスポンススキーマ#
注釈
この操作には認証が必要ありません