Esta versión de GitHub Enterprise se discontinuó el 2022-06-03. No se realizarán lanzamientos de patch, ni siquiera para problemas de seguridad críticos. Para obtener un mejor desempeño, más seguridad y nuevas características, actualiza a la última versión de GitHub Enterprise. Para obtener ayuda con la actualización, contacta al soporte 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.
Global Webhooks
Global Webhooks are installed on your enterprise. 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 evento para organizaciones, usuarios, repositorios, equipos, miembros, membrecías, bifuraciones, y pings.
Esta API solo se encuentra disponible para los administradores de sitio autenticados. Los usuarios normales recibirán una respuesta 404
si intentan acceder a ella. Para aprender cómo configurar los webhooks globales, consulta la sección Acerca de los webhooks globales.
List global webhooks
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de consulta |
Nombre, Tipo, Descripción |
per_page integerThe number of results per page (max 100). Predeterminado: |
page integerPage number of the results to fetch. Predeterminado: |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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"
}
]
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+json
Create a global webhook
Parámetros
Encabezados | ||||||||
---|---|---|---|---|---|---|---|---|
Nombre, Tipo, Descripción | ||||||||
accept stringSetting to | ||||||||
Parámetros de cuerpo | ||||||||
Nombre, Tipo, Descripción | ||||||||
name stringRequeridoMust be passed as "web". | ||||||||
config objectRequeridoKey/value pairs to provide settings for this webhook. | ||||||||
Properties of the |
Nombre, Tipo, Descripción |
---|
url stringRequeridoThe 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 stringDetermines whether the SSL certificate of the host for |
events
array of stringsThe events that trigger this webhook. A global webhook can be triggered by user
and organization
events. Default: user
and organization
.
active
booleanDetermines if notifications are sent when the webhook is triggered. Set to true
to send notifications.
Predeterminado: true
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
201 | Created |
Ejemplos de código
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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+json
Get a global webhook
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
hook_id integerRequeridoThe unique identifier of the hook. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
Ejemplos de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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"
}
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+json
Update a global webhook
Parameters that are not provided will be overwritten with the default value or removed if no default exists.
Parámetros
Encabezados | ||||||||
---|---|---|---|---|---|---|---|---|
Nombre, Tipo, Descripción | ||||||||
accept stringSetting to | ||||||||
Parámetros de ruta | ||||||||
Nombre, Tipo, Descripción | ||||||||
hook_id integerRequeridoThe unique identifier of the hook. | ||||||||
Parámetros de cuerpo | ||||||||
Nombre, Tipo, Descripción | ||||||||
config objectKey/value pairs to provide settings for this webhook. | ||||||||
Properties of the |
Nombre, Tipo, Descripción |
---|
url stringRequeridoThe 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 stringDetermines whether the SSL certificate of the host for |
events
array of stringsThe events that trigger this webhook. A global webhook can be triggered by user
and organization
events. Default: user
and organization
.
active
booleanDetermines if notifications are sent when the webhook is triggered. Set to true
to send notifications.
Predeterminado: true
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
200 | OK |
Ejemplos de código
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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+json
Delete a global webhook
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
hook_id integerRequeridoThe unique identifier of the hook. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
204 | No Content |
Ejemplos de código
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID
Response
Status: 204
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+json
Ping a global webhook
This will trigger a ping event to be sent to the webhook.
Parámetros
Encabezados |
---|
Nombre, Tipo, Descripción |
accept stringSetting to |
Parámetros de ruta |
Nombre, Tipo, Descripción |
hook_id integerRequeridoThe unique identifier of the hook. |
Códigos de estado de respuesta HTTP
Código de estado | Descripción |
---|---|
204 | No Content |
Ejemplos de código
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/hooks/HOOK_ID/pings
Response
Status: 204
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+json