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 die Sicherheit und Analyse von Enterprise-Code

Verwende die REST-API, um Features für Codesicherheit und -analyse für dein Unternehmen zu verwalten.

Get code security and analysis features for an enterprise

Gets code security and analysis settings for the specified enterprise.

The authenticated user must be an administrator of the enterprise in order to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Parameter für „Get code security and analysis features for an enterprise“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
enterprise string Erforderlich

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

HTTP-Antwortstatuscodes für „Get code security and analysis features for an enterprise“

StatuscodeBESCHREIBUNG
200

OK

404

Resource not found

Codebeispiele für „Get code security and analysis features for an enterprise“

Beispiel für eine Anfrage

get/enterprises/{enterprise}/code_security_and_analysis
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/code_security_and_analysis

Response

Status: 200
{ "advanced_security_enabled_for_new_repositories": true, "dependabot_alerts_enabled_for_new_repositories": true, "secret_scanning_enabled_for_new_repositories": true, "secret_scanning_push_protection_enabled_for_new_repositories": true, "secret_scanning_push_protection_custom_link": "https://github.com/test-org/test-repo/blob/main/README.md" }

Update code security and analysis features for an enterprise

Updates the settings for advanced security, secret scanning, and push protection for new repositories in an enterprise.

The authenticated user must be an administrator of the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Parameter für „Update code security and analysis features for an enterprise“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
enterprise string Erforderlich

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

Textparameter
Name, type, BESCHREIBUNG
dependabot_alerts_enabled_for_new_repositories boolean

Whether Dependabot alerts are automatically enabled for new repositories. For more information, see "About Dependabot alerts."

HTTP-Antwortstatuscodes für „Update code security and analysis features for an enterprise“

StatuscodeBESCHREIBUNG
204

Action started

404

Resource not found

422

The action could not be taken due to an in progress enablement, or a policy is preventing enablement

Codebeispiele für „Update code security and analysis features for an enterprise“

Beispiel für eine Anfrage

patch/enterprises/{enterprise}/code_security_and_analysis
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/code_security_and_analysis \ -d '{"advanced_security_enabled_for_new_repositories":true,"dependabot_alerts_enabled_for_new_repositories":true,"secret_scanning_enabled_for_new_repositories":true,"secret_scanning_push_protection_enabled_for_new_repositories":true,"secret_scanning_push_protection_custom_link":"https://github.com/test-org/test-repo/blob/main/README.md"}'

Action started

Status: 204

Enable or disable a security feature

Enables or disables the specified security feature for all repositories in an enterprise.

The authenticated user must be an administrator of the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

Parameter für „Enable or disable a security feature“

Header
Name, type, BESCHREIBUNG
accept string

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

Pfadparameter
Name, type, BESCHREIBUNG
enterprise string Erforderlich

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

security_product string Erforderlich

The security feature to enable or disable.

Kann eine der Folgenden sein: advanced_security, secret_scanning, secret_scanning_push_protection

enablement string Erforderlich

The action to take.

enable_all means to enable the specified security feature for all repositories in the enterprise. disable_all means to disable the specified security feature for all repositories in the enterprise.

Kann eine der Folgenden sein: enable_all, disable_all

HTTP-Antwortstatuscodes für „Enable or disable a security feature“

StatuscodeBESCHREIBUNG
204

Action started

404

Resource not found

422

The action could not be taken due to an in progress enablement, or a policy is preventing enablement

Codebeispiele für „Enable or disable a security feature“

Beispiel für eine Anfrage

post/enterprises/{enterprise}/{security_product}/{enablement}
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/SECURITY_PRODUCT/ENABLEMENT

Action started

Status: 204