Skip to main content

Diese Version von GitHub Enterprise Server wurde eingestellt am 2024-03-26. Es wird keine Patch-Freigabe vorgenommen, auch nicht für kritische Sicherheitsprobleme. Für bessere Leistung, verbesserte Sicherheit und neue Features aktualisiere auf die neueste Version von GitHub Enterprise Server. Wende dich an den GitHub Enterprise-Support, um Hilfe zum Upgrade zu erhalten.

Nachdem deine Enterprise Server-Instanz durch Websiteadministrator*innen auf Enterprise Server 3.9 oder höher aktualisiert wurde, erhält die REST-API eine Versionskontrolle. Weitere Informationen zum Ermitteln der Version deiner Instanz findest du unter Informationen zu Versionen der GitHub-Dokumentation. Weitere Informationen findest du unter Informationen zur API-Versionsverwaltung.

REST-API-Endpunkte für globale Webhooks

Verwende die REST-API, um globale Webhooks für dein Unternehmen zu verwalten.

Informationen zu globalen Webhooks

Diese Endpunkte sind nur für authentifizierte Websiteadministratorinnen verfügbar. Normale Benutzerinnen erhalten eine 404-Antwort. Eine Anleitung zum Konfigurieren globaler Webhooks findest du unter Informationen zu globalen Webhooks.

Globale Webhooks sind automatisch für dein Unternehmen installiert. Du kannst globale Webhooks verwenden, um automatisch Regeln für Benutzer, Organisationen, Teams und Repositorys in deinem Unternehmen zu überwachen, darauf zu reagieren oder sie zu erzwingen.

Globale Webhooks können die Ereignistypen Organisation, Benutzer, Repository, Team, Mitglied, Mitgliedschaft, Fork und Ping abonnieren.

List global webhooks

Parameter für „List global webhooks“

Header
Name, type, BESCHREIBUNG
accept string

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

Abfrageparameter
Name, type, BESCHREIBUNG
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Standard: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Standard: 1

HTTP-Antwortstatuscodes für „List global webhooks“

StatuscodeBESCHREIBUNG
200

OK

Codebeispiele für „List global webhooks“

Beispiel für eine Anfrage

get/admin/hooks
curl -L \ -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://HOSTNAME/admin/hooks/1", "ping_url": "https://HOSTNAME/admin/hooks/1/pings" } ]

Create a global webhook

Parameter für „Create a global webhook“

Header
Name, type, BESCHREIBUNG
accept string

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

Textparameter
Name, type, BESCHREIBUNG
name string Erforderlich

Must be passed as "web".

config object Erforderlich

Key/value pairs to provide settings for this webhook.

Name, type, BESCHREIBUNG
url string Erforderlich

The URL to which the payloads will be delivered.

content_type string

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

secret string

If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header.

insecure_ssl string

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.

events array of strings

The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.

active boolean

Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.

Standard: true

HTTP-Antwortstatuscodes für „Create a global webhook“

StatuscodeBESCHREIBUNG
201

Created

Codebeispiele für „Create a global webhook“

Beispiel für eine Anfrage

post/admin/hooks
curl -L \ -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://HOSTNAME/admin/hooks/1", "ping_url": "https://HOSTNAME/admin/hooks/1/pings" }

Get a global webhook

Parameter für „Get a global webhook“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
hook_id integer Erforderlich

The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

HTTP-Antwortstatuscodes für „Get a global webhook“

StatuscodeBESCHREIBUNG
200

OK

Codebeispiele für „Get a global webhook“

Beispiel für eine Anfrage

get/admin/hooks/{hook_id}
curl -L \ -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://HOSTNAME/admin/hooks/1", "ping_url": "https://HOSTNAME/admin/hooks/1/pings" }

Update a global webhook

Parameters that are not provided will be overwritten with the default value or removed if no default exists.

Parameter für „Update a global webhook“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
hook_id integer Erforderlich

The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

Textparameter
Name, type, BESCHREIBUNG
config object

Key/value pairs to provide settings for this webhook.

Name, type, BESCHREIBUNG
url string Erforderlich

The URL to which the payloads will be delivered.

content_type string

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

secret string

If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header.

insecure_ssl string

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.

events array of strings

The events that trigger this webhook. A global webhook can be triggered by user and organization events. Default: user and organization.

active boolean

Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.

Standard: true

HTTP-Antwortstatuscodes für „Update a global webhook“

StatuscodeBESCHREIBUNG
200

OK

Codebeispiele für „Update a global webhook“

Beispiel für eine Anfrage

patch/admin/hooks/{hook_id}
curl -L \ -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://HOSTNAME/admin/hooks/1", "ping_url": "https://HOSTNAME/admin/hooks/1/pings" }

Delete a global webhook

Parameter für „Delete a global webhook“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
hook_id integer Erforderlich

The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

HTTP-Antwortstatuscodes für „Delete a global webhook“

StatuscodeBESCHREIBUNG
204

No Content

Codebeispiele für „Delete a global webhook“

Beispiel für eine Anfrage

delete/admin/hooks/{hook_id}
curl -L \ -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

Ping a global webhook

This will trigger a ping event to be sent to the webhook.

Parameter für „Ping a global webhook“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
hook_id integer Erforderlich

The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.

HTTP-Antwortstatuscodes für „Ping a global webhook“

StatuscodeBESCHREIBUNG
204

No Content

Codebeispiele für „Ping a global webhook“

Beispiel für eine Anfrage

post/admin/hooks/{hook_id}/pings
curl -L \ -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