グローバル Webhook の REST API エンドポイント
この REST API を使い、企業のグローバル Webhook を管理します。
グローバルwebhookについて
これらのエンドポイントは認証されたサイト管理者のみが利用できます。通常のユーザーには 404 応答が届きます。 グローバル Webhook を構成する方法については、「グローバル Webhook について」を参照してください。
グローバル Webhook は企業に自動的にインストールされます。 グローバル webhook を使用して、エンタープライズのユーザ、組織、チーム、およびリポジトリに対するルールを自動的に監視、対応、または強制することができます。
グローバル Webhook は、Organization、ユーザー、リポジトリ、チーム、メンバー、メンバーシップ、フォーク、および ping イベントの種類をサブスクライブできます。
メモ
これらのエンドポイントでは、personal access token (classic) を使う認証のみがサポートされます。 詳しくは、「個人用アクセス トークンを管理する」をご覧ください。
List global webhooks
fine_grained_access
no_fine_grained_access
"List global webhooks" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." デフォルト: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." デフォルト: |
http_status_code
| status_code | 説明 |
|---|---|
200 | OK |
code_samples
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/admin/hooksResponse
Status: 200[
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://HOSTNAME/admin/hooks/1",
"ping_url": "https://HOSTNAME/admin/hooks/1/pings"
}
]Create a global webhook
fine_grained_access
no_fine_grained_access
"Create a global webhook" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 | |||||
|---|---|---|---|---|---|
name string 必須Must be passed as "web". | |||||
config object 必須Key/value pairs to provide settings for this webhook. | |||||
Properties of |
| 名前, タイプ, 説明 |
|---|
url string 必須The URL to which the payloads will be delivered. |
content_type string The media type used to serialize the payloads. Supported values include |
secret string If provided, the |
insecure_ssl string Determines whether the SSL certificate of the host for |
events array of strings The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.
active boolean Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.
デフォルト: true
http_status_code
| status_code | 説明 |
|---|---|
201 | Created |
code_samples
request_example
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/admin/hooks \
-d '{"name":"web","events":["organization","user"],"config":{"url":"https://example.com/webhook","content_type":"json","secret":"secret"}}'Response
Status: 201{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://HOSTNAME/admin/hooks/1",
"ping_url": "https://HOSTNAME/admin/hooks/1/pings"
}Get a global webhook
fine_grained_access
no_fine_grained_access
"Get a global webhook" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
hook_id integer 必須The unique identifier of the hook. You can find this value in the |
http_status_code
| status_code | 説明 |
|---|---|
200 | OK |
code_samples
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_IDResponse
Status: 200{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://HOSTNAME/admin/hooks/1",
"ping_url": "https://HOSTNAME/admin/hooks/1/pings"
}Update a global webhook
Parameters that are not provided will be overwritten with the default value or removed if no default exists.
fine_grained_access
no_fine_grained_access
"Update a global webhook" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
hook_id integer 必須The unique identifier of the hook. You can find this value in the |
| 名前, タイプ, 説明 | |||||
|---|---|---|---|---|---|
config object Key/value pairs to provide settings for this webhook. | |||||
Properties of |
| 名前, タイプ, 説明 |
|---|
url string 必須The URL to which the payloads will be delivered. |
content_type string The media type used to serialize the payloads. Supported values include |
secret string If provided, the |
insecure_ssl string Determines whether the SSL certificate of the host for |
events array of strings The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.
active boolean Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.
デフォルト: true
http_status_code
| status_code | 説明 |
|---|---|
200 | OK |
code_samples
request_example
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID \
-d '{"events":["organization"],"config":{"url":"https://example.com/webhook"}}'Response
Status: 200{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization"
],
"config": {
"url": "https://example.com",
"content_type": "form",
"insecure_ssl": "0"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://HOSTNAME/admin/hooks/1",
"ping_url": "https://HOSTNAME/admin/hooks/1/pings"
}Delete a global webhook
fine_grained_access
no_fine_grained_access
"Delete a global webhook" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
hook_id integer 必須The unique identifier of the hook. You can find this value in the |
http_status_code
| status_code | 説明 |
|---|---|
204 | No Content |
code_samples
request_example
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_IDResponse
Status: 204Ping a global webhook
This will trigger a ping event to be sent to the webhook.
fine_grained_access
no_fine_grained_access
"Ping a global webhook" のパラメーター
| 名前, タイプ, 説明 |
|---|
accept string Setting to |
| 名前, タイプ, 説明 |
|---|
hook_id integer 必須The unique identifier of the hook. You can find this value in the |
http_status_code
| status_code | 説明 |
|---|---|
204 | No Content |
code_samples
request_example
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID/pingsResponse
Status: 204