Недавно мы переехали некоторые из документации по REST API. Если вы не можете найти нужные сведения, попробуйте использовать новые страницы REST API Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks REST API.
Конфигурация веб-перехватчика репозитория
Используйте REST API для управления конфигурацией для веб-перехватчиков репозитория.
Get a webhook configuration for a repository
Returns the webhook configuration for a repository. To get more information about the webhook, including the active
state and events
, use "Get a repository webhook."
Access tokens must have the read:repo_hook
or repo
scope, and GitHub Apps must have the repository_hooks:read
permission.
Параметры для "Get a webhook configuration for a repository"
Имя, Type, Description |
---|
accept string Setting to |
Имя, Type, Description |
---|
owner string Обязательное полеThe account owner of the repository. The name is not case sensitive. |
repo string Обязательное полеThe name of the repository without the |
hook_id integer Обязательное полеThe unique identifier of the hook. You can find this value in the |
Коды состояния http-ответа для "Get a webhook configuration for a repository"
Код состояния | Описание |
---|---|
200 | OK |
Примеры кода для "Get a webhook configuration for a repository"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/hooks/HOOK_ID/config
Response
Status: 200
{
"content_type": "json",
"insecure_ssl": "0",
"secret": "********",
"url": "https://example.com/webhook"
}
Update a webhook configuration for a repository
Updates the webhook configuration for a repository. To update more information about the webhook, including the active
state and events
, use "Update a repository webhook."
Access tokens must have the write:repo_hook
or repo
scope, and GitHub Apps must have the repository_hooks:write
permission.
Параметры для "Update a webhook configuration for a repository"
Имя, Type, Description |
---|
accept string Setting to |
Имя, Type, Description |
---|
owner string Обязательное полеThe account owner of the repository. The name is not case sensitive. |
repo string Обязательное полеThe name of the repository without the |
hook_id integer Обязательное полеThe unique identifier of the hook. You can find this value in the |
Имя, Type, 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 or number Determines whether the SSL certificate of the host for |
Коды состояния http-ответа для "Update a webhook configuration for a repository"
Код состояния | Описание |
---|---|
200 | OK |
Примеры кода для "Update a webhook configuration for a repository"
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/repos/OWNER/REPO/hooks/HOOK_ID/config \
-d '{"content_type":"json","url":"https://example.com/webhook"}'
Response
Status: 200
{
"content_type": "json",
"insecure_ssl": "0",
"secret": "********",
"url": "https://example.com/webhook"
}