Skip to main content

このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2023-01-18. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの向上、新機能の向上を図るために、最新バージョンの GitHub Enterprise にアップグレードします。 アップグレードに関するヘルプについては、GitHub Enterprise サポートにお問い合わせく� さい

We've recently moved some of the REST API documentation. If you can't find what you're looking for, you might try the Actions REST API page.

グローバル Webhook

グローバル webhook は Enterprise にインストールされています。 グローバル webhook を使用して、Engerprise のユーザ、Organization、Team、およびリポジトリのルールを自動的に監視、対応、強制することができます。

グローバル Webhook は、Organizationユーザーリポジトリチー� メンバーメンバーシップフォーク、および ping イベントの種類をサブスクライブできます。

この API は、認証されたサイト管理者のみが使えます。 通常のユーザーは、アクセスしようとすると 404 応答を受け取ります。 グローバル Webhook を構成する方法については、「グローバル Webhook について」を参照してく� さい。

List global webhooks

パラメーター

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Query parameters
Name, Type, Description
per_pageinteger

The number of results per page (max 100).

Default: 30

pageinteger

Page number of the results to fetch.

Default: 1

HTTP 応答状態コード

status code説明
200

OK

コード サンプル

get/admin/hooks
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/hooks

Response

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://api.github.com/admin/hooks/1", "ping_url": "https://api.github.com/admin/hooks/1/pings" } ]

Create a global webhook

パラメーター

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Body parameters
Name, Type, Description
namestringRequired

Must be passed as "web".

configobjectRequired

Key/value pairs to provide settings for this webhook.

Name, Type, Description
urlstringRequired

The URL to which the payloads will be delivered.

content_typestring

The media type used to serialize the payloads. Supported values include json and form. The default is form.

secretstring

If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header.

insecure_sslstring

Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.

eventsarray of strings

The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.

activeboolean

Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.

Default: true

HTTP 応答状態コード

status code説明
201

Created

コード サンプル

post/admin/hooks
curl \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ 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://api.github.com/admin/hooks/1", "ping_url": "https://api.github.com/admin/hooks/1/pings" }

Get a global webhook

パラメーター

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
hook_idintegerRequired

The unique identifier of the hook.

HTTP 応答状態コード

status code説明
200

OK

コード サンプル

get/admin/hooks/{hook_id}
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID

Response

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://api.github.com/admin/hooks/1", "ping_url": "https://api.github.com/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.

パラメーター

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
hook_idintegerRequired

The unique identifier of the hook.

Body parameters
Name, Type, Description
configobject

Key/value pairs to provide settings for this webhook.

Name, Type, Description
urlstringRequired

The URL to which the payloads will be delivered.

content_typestring

The media type used to serialize the payloads. Supported values include json and form. The default is form.

secretstring

If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header.

insecure_sslstring

Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.

eventsarray of strings

The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.

activeboolean

Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.

Default: true

HTTP 応答状態コード

status code説明
200

OK

コード サンプル

patch/admin/hooks/{hook_id}
curl \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ 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://api.github.com/admin/hooks/1", "ping_url": "https://api.github.com/admin/hooks/1/pings" }

Delete a global webhook

パラメーター

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
hook_idintegerRequired

The unique identifier of the hook.

HTTP 応答状態コード

status code説明
204

No Content

コード サンプル

delete/admin/hooks/{hook_id}
curl \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID

Response

Status: 204

Ping a global webhook

This will trigger a ping event to be sent to the webhook.

パラメーター

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
hook_idintegerRequired

The unique identifier of the hook.

HTTP 応答状態コード

status code説明
204

No Content

コード サンプル

post/admin/hooks/{hook_id}/pings
curl \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID/pings

Response

Status: 204