Esta versão do GitHub Enterprise foi descontinuada em 2022-10-12. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, segurança aprimorada e novos recursos, atualize para a última versão do GitHub Enterprise. Para obter ajuda com a atualização, entre em contato com o suporte do 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. You can use global webhooks to automatically monitor, respond to, or enforce rules for users, organizations, teams, and repositories on your enterprise.
Global webhooks can subscribe to the organization, user, repository, team, member, membership, fork, and ping event types.
This API is only available to authenticated site administrators. Normal users will receive a 404
response if they try to access it. To learn how to configure global webhooks, see About global webhooks.
List global webhooks
Parâmetros
Headers |
---|
Name, Type, Description |
accept stringSetting to |
Query parameters |
Name, Type, Description |
per_page integerThe number of results per page (max 100). Default: |
page integerPage number of the results to fetch. Default: |
Códigos de status de resposta HTTP
Código de status | Descrição |
---|---|
200 | OK |
Exemplos de código
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-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 pré-visualização
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
Headers | ||||||||
---|---|---|---|---|---|---|---|---|
Name, Type, Description | ||||||||
accept stringSetting to | ||||||||
Body parameters | ||||||||
Name, Type, Description | ||||||||
name stringRequiredMust be passed as "web". | ||||||||
config objectRequiredKey/value pairs to provide settings for this webhook. | ||||||||
Properties of config
| ||||||||
events array of stringsThe events that trigger this webhook. A global webhook can be triggered by | ||||||||
active booleanDetermines if notifications are sent when the webhook is triggered. Set to Default: |
Códigos de status de resposta HTTP
Código de status | Descrição |
---|---|
201 | Created |
Exemplos 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 pré-visualização
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
Headers |
---|
Name, Type, Description |
accept stringSetting to |
Path parameters |
Name, Type, Description |
hook_id integerRequiredThe unique identifier of the hook. |
Códigos de status de resposta HTTP
Código de status | Descrição |
---|---|
200 | OK |
Exemplos de código
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-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 pré-visualização
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
Headers | ||||||||
---|---|---|---|---|---|---|---|---|
Name, Type, Description | ||||||||
accept stringSetting to | ||||||||
Path parameters | ||||||||
Name, Type, Description | ||||||||
hook_id integerRequiredThe unique identifier of the hook. | ||||||||
Body parameters | ||||||||
Name, Type, Description | ||||||||
config objectKey/value pairs to provide settings for this webhook. | ||||||||
Properties of config
| ||||||||
events array of stringsThe events that trigger this webhook. A global webhook can be triggered by | ||||||||
active booleanDetermines if notifications are sent when the webhook is triggered. Set to Default: |
Códigos de status de resposta HTTP
Código de status | Descrição |
---|---|
200 | OK |
Exemplos 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 pré-visualização
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
Headers |
---|
Name, Type, Description |
accept stringSetting to |
Path parameters |
Name, Type, Description |
hook_id integerRequiredThe unique identifier of the hook. |
Códigos de status de resposta HTTP
Código de status | Descrição |
---|---|
204 | No Content |
Exemplos 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_ID
Response
Status: 204
Aviso de pré-visualização
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
Headers |
---|
Name, Type, Description |
accept stringSetting to |
Path parameters |
Name, Type, Description |
hook_id integerRequiredThe unique identifier of the hook. |
Códigos de status de resposta HTTP
Código de status | Descrição |
---|---|
204 | No Content |
Exemplos 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/pings
Response
Status: 204
Aviso de pré-visualização
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