Esta versión de GitHub Enterprise se discontinuó el 2022-10-12. No se realizarán lanzamientos de patch, ni siquiera para problemas de seguridad críticos. Para obtener rendimiento mejorado, seguridad mejorada y nuevas características, actualice a la versión más reciente de GitHub Enterprise. Para obtener ayuda con la actualización, póngase en contacto con el soporte técnico de 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.
Webhooks globales
Los webhooks globales se instalan en tu empresa. Puedes utilizar los webhooks globales para monitorear, responder a, o requerir las reglas para los usuarios, organizaciones, equipos y repositorios en tu empresa.
Los webhooks globales se pueden suscribir a los tipos de eventos de organización, usuario, repositorio, equipo, miembro, pertenencia, bifurcación y ping.
Esta API solo está disponible para los administradores de sitios autenticados . Los usuarios normales recibirán una respuesta 404 si intentan acceder a ella. Para obtener información sobre cómo configurar webhooks globales, vea Acerca de los webhooks globales.
List global webhooks
Parámetros
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Query parameters |
| Name, Type, Description |
per_pageintegerThe number of results per page (max 100). Default: |
pageintegerPage number of the results to fetch. Default: |
Códigos de estado de respuesta HTTP
| status code | Descripción |
|---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
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://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
]Aviso de previsualización
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+jsonCreate a global webhook
Parámetros
| Headers | ||||||||
|---|---|---|---|---|---|---|---|---|
| Name, Type, Description | ||||||||
acceptstringSetting to | ||||||||
| Body parameters | ||||||||
| Name, Type, Description | ||||||||
namestringRequiredMust be passed as "web". | ||||||||
configobjectRequiredKey/value pairs to provide settings for this webhook. | ||||||||
Properties of config
| ||||||||
eventsarray of stringsThe events that trigger this webhook. A global webhook can be triggered by | ||||||||
activebooleanDetermines if notifications are sent when the webhook is triggered. Set to Default: | ||||||||
Códigos de estado de respuesta HTTP
| status code | Descripción |
|---|---|
201 | Created |
Ejemplos de código
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"
}Aviso de previsualización
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+jsonGet a global webhook
Parámetros
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
hook_idintegerRequiredThe unique identifier of the hook. |
Códigos de estado de respuesta HTTP
| status code | Descripción |
|---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
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://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}Aviso de previsualización
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+jsonUpdate a global webhook
Parameters that are not provided will be overwritten with the default value or removed if no default exists.
Parámetros
| Headers | ||||||||
|---|---|---|---|---|---|---|---|---|
| Name, Type, Description | ||||||||
acceptstringSetting to | ||||||||
| Path parameters | ||||||||
| Name, Type, Description | ||||||||
hook_idintegerRequiredThe unique identifier of the hook. | ||||||||
| Body parameters | ||||||||
| Name, Type, Description | ||||||||
configobjectKey/value pairs to provide settings for this webhook. | ||||||||
Properties of config
| ||||||||
eventsarray of stringsThe events that trigger this webhook. A global webhook can be triggered by | ||||||||
activebooleanDetermines if notifications are sent when the webhook is triggered. Set to Default: | ||||||||
Códigos de estado de respuesta HTTP
| status code | Descripción |
|---|---|
200 | OK |
Ejemplos de código
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"
}Aviso de previsualización
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+jsonDelete a global webhook
Parámetros
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
hook_idintegerRequiredThe unique identifier of the hook. |
Códigos de estado de respuesta HTTP
| status code | Descripción |
|---|---|
204 | No Content |
Ejemplos de código
curl \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_IDResponse
Status: 204Aviso de previsualización
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+jsonPing a global webhook
This will trigger a ping event to be sent to the webhook.
Parámetros
| Headers |
|---|
| Name, Type, Description |
acceptstringSetting to |
| Path parameters |
| Name, Type, Description |
hook_idintegerRequiredThe unique identifier of the hook. |
Códigos de estado de respuesta HTTP
| status code | Descripción |
|---|---|
204 | No Content |
Ejemplos de código
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID/pingsResponse
Status: 204Aviso de previsualización
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept header:
application/vnd.github.superpro-preview+json