Конечные точки REST API для глобальных веб-перехватчиков
Используйте REST API для управления глобальными веб-перехватчиками для вашего предприятия.
Сведения о глобальных веб-перехватчиках
Эти конечные точки доступны только администраторам сайта, прошедшим проверку подлинности, обычные пользователи получат 404 ответ. Сведения о настройке глобальных веб-перехватчиков см. в разделе Сведения о глобальных веб-перехватчиках.
Глобальные веб-перехватчики автоматически устанавливаются в вашей организации. Глобальные веб-перехватчики можно использовать для автоматического мониторинга, реагирования или применения правил для пользователей, организаций, команд и репозиториев на предприятии.
Глобальные веб-перехватчики могут подписаться на такие типы событий, как организация, пользователь, репозиторий, команда, член, членство, вилка и проверка связи.
Примечание.
Эти конечные точки поддерживают проверку подлинности только с помощью personal access token (classic). Дополнительные сведения см. в разделе Управление личными маркерами доступа.
List global webhooks
Подробные маркеры доступа для "List global webhooks
Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.
Параметры для "List global webhooks"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
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-ответа для "List global webhooks"
| Код состояния | Описание |
|---|---|
200 | OK |
Примеры кода для "List global webhooks"
Пример запроса
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": "http://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "http://HOSTNAME/admin/hooks/1",
"ping_url": "http://HOSTNAME/admin/hooks/1/pings"
}
]Create a global webhook
Подробные маркеры доступа для "Create a global webhook
Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.
Параметры для "Create a global webhook"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description | |||||
|---|---|---|---|---|---|
name string Обязательное полеMust be passed as "web". | |||||
config object Обязательное полеKey/value pairs to provide settings for this webhook. | |||||
Properties of |
| Имя., Тип, Description |
|---|
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-ответа для "Create a global webhook"
| Код состояния | Описание |
|---|---|
201 | Created |
Примеры кода для "Create a global webhook"
Пример запроса
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":"http://example.com/webhook","content_type":"json","secret":"secret"}}'Response
Status: 201{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "http://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "http://HOSTNAME/admin/hooks/1",
"ping_url": "http://HOSTNAME/admin/hooks/1/pings"
}Get a global webhook
Подробные маркеры доступа для "Get a global webhook
Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.
Параметры для "Get a global webhook"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
hook_id integer Обязательное полеThe unique identifier of the hook. You can find this value in the |
Коды состояния http-ответа для "Get a global webhook"
| Код состояния | Описание |
|---|---|
200 | OK |
Примеры кода для "Get a global webhook"
Пример запроса
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": "http://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "http://HOSTNAME/admin/hooks/1",
"ping_url": "http://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.
Подробные маркеры доступа для "Update a global webhook
Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.
Параметры для "Update a global webhook"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
hook_id integer Обязательное полеThe unique identifier of the hook. You can find this value in the |
| Имя., Тип, Description | |||||
|---|---|---|---|---|---|
config object Key/value pairs to provide settings for this webhook. | |||||
Properties of |
| Имя., Тип, Description |
|---|
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-ответа для "Update a global webhook"
| Код состояния | Описание |
|---|---|
200 | OK |
Примеры кода для "Update a global webhook"
Пример запроса
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":"http://example.com/webhook"}}'Response
Status: 200{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization"
],
"config": {
"url": "http://example.com",
"content_type": "form",
"insecure_ssl": "0"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "http://HOSTNAME/admin/hooks/1",
"ping_url": "http://HOSTNAME/admin/hooks/1/pings"
}Delete a global webhook
Подробные маркеры доступа для "Delete a global webhook
Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.
Параметры для "Delete a global webhook"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
hook_id integer Обязательное полеThe unique identifier of the hook. You can find this value in the |
Коды состояния http-ответа для "Delete a global webhook"
| Код состояния | Описание |
|---|---|
204 | No Content |
Примеры кода для "Delete a global webhook"
Пример запроса
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.
Подробные маркеры доступа для "Ping a global webhook
Эта конечная точка не работает с маркерами доступа пользователей приложения GitHub, маркерами доступа к установке приложения GitHub или точными личными маркерами доступа.
Параметры для "Ping a global webhook"
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
hook_id integer Обязательное полеThe unique identifier of the hook. You can find this value in the |
Коды состояния http-ответа для "Ping a global webhook"
| Код состояния | Описание |
|---|---|
204 | No Content |
Примеры кода для "Ping a global webhook"
Пример запроса
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