Skip to main content

Esta versão do GitHub Enterprise foi descontinuada em 2022-06-03. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, melhorar a segurança e novos recursos, upgrade to the latest version of GitHub Enterprise. Para ajuda com a atualização, contact GitHub Enterprise support.

Webhooks do aplicativo GitHub

Sobre a API de webhooks do aplicativo GitHub

O webhook de aplicativo GitHub permite que você receba cargas POST de HTTP sempre que certos eventos ocorrerem para um aplicativo. The webhook REST APIs enable you to manage repository, organization, and app webhooks. You can also use the REST API to change the configuration of the webhook. Por exemplo, você pode modificar a URL da carga, tipo de conteúdo, verificação de SSL e segredo. Para obter mais informações, consulte:

Get a webhook configuration for an app

Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "Creating a GitHub App."

You must use a JWT to access this endpoint.

HTTP response status codes

Status codeDescrição
200

OK

Amostras de código

get/app/hook/config
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/app/hook/config

Response

Status: 200
{ "content_type": "json", "insecure_ssl": "0", "secret": "********", "url": "https://example.com/webhook" }

Update a webhook configuration for an app

Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "Creating a GitHub App."

You must use a JWT to access this endpoint.

Parâmetros

Headers
Nome, Tipo, Descrição
acceptstring

Setting to application/vnd.github.v3+json is recommended.

Body parameters
Nome, Tipo, Descrição
urlstring

The URL to which the payloads will be delivered.

content_typestring

The media type used to serialize the payloads. Supported values include json and form. The default is form.

secretstring

If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.

insecure_sslstring or number or

Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.

HTTP response status codes

Status codeDescrição
200

OK

Amostras de código

patch/app/hook/config
curl \ -X PATCH \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <TOKEN>" \ http(s)://HOSTNAME/api/v3/app/hook/config \ -d '{"content_type":"json","insecure_ssl":"0","secret":"********","url":"https://example.com/webhook"}'

Response

Status: 200
{ "content_type": "json", "insecure_ssl": "0", "secret": "********", "url": "https://example.com/webhook" }