Nous avons récemment déplacé une partie de la documentation de l’API REST. Si vous ne trouvez pas ce que vous recherchez, vous pouvez essayer les nouvelles pages d’API REST Branches, Collaborators, Commits, Deploy Keys, Deployments, GitHub Pages, Releases, Metrics, Webhooks.
Configuration du webhook d’un dépôt
Utilisez l’API REST pour gérer la configuration des webhooks de dépôt.
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.
Paramètres pour « Get a webhook configuration for a repository »
En-têtes |
---|
Nom, Type, Description |
accept stringSetting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
owner stringObligatoireThe account owner of the repository. The name is not case sensitive. |
repo stringObligatoireThe name of the repository. The name is not case sensitive. |
hook_id integerObligatoireThe unique identifier of the hook. |
Codes d’état de la réponse HTTP pour « Get a webhook configuration for a repository »
Code d’état | Description |
---|---|
200 | OK |
Exemples de code pour « Get a webhook configuration for a repository »
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://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.
Paramètres pour « Update a webhook configuration for a repository »
En-têtes |
---|
Nom, Type, Description |
accept stringSetting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
owner stringObligatoireThe account owner of the repository. The name is not case sensitive. |
repo stringObligatoireThe name of the repository. The name is not case sensitive. |
hook_id integerObligatoireThe unique identifier of the hook. |
Paramètres du corps |
Nom, Type, Description |
url stringThe URL to which the payloads will be delivered. |
content_type stringThe media type used to serialize the payloads. Supported values include |
secret stringIf provided, the |
insecure_ssl string or numberDetermines whether the SSL certificate of the host for |
Codes d’état de la réponse HTTP pour « Update a webhook configuration for a repository »
Code d’état | Description |
---|---|
200 | OK |
Exemples de code pour « Update a webhook configuration for a repository »
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://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"
}