Skip to main content
サイト管理者が Enterprise Server インスタンスを Enterprise Server 3.9 以降にアップグレードすると、REST API はバージョン管理されます。 インスタンスのバージョンを検索する方法については、「GitHub Docs のバージョンについて」を参照してください。 詳細については、「API のバージョン管理について」を参照してください。

コードのセキュリティと分析

REST API を使って、エンタープライズに対するコードのセキュリティと分析の機能を管理します。

Get code security and analysis features for an enterprise

Gets code security and analysis settings for the specified enterprise. To use this endpoint, you must be an administrator of the enterprise, and you must use an access token with the admin:enterprise scope.

"Get code security and analysis features for an enterprise" のパラメーター

ヘッダー
名前, Type, 説明
accept string

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

パス パラメーター
名前, Type, 説明
enterprise string 必須

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

"Get code security and analysis features for an enterprise" の HTTP 応答状態コード

状態コード説明
200

OK

404

Resource not found

"Get code security and analysis features for an enterprise" のコード サンプル

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. To use this endpoint, you must be an administrator of the enterprise, and you must use an access token with the admin:enterprise scope.

"Update code security and analysis features for an enterprise" のパラメーター

ヘッダー
名前, Type, 説明
accept string

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

パス パラメーター
名前, Type, 説明
enterprise string 必須

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

本文のパラメーター
名前, Type, 説明
dependabot_alerts_enabled_for_new_repositories boolean

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

"Update code security and analysis features for an enterprise" の HTTP 応答状態コード

状態コード説明
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

"Update code security and analysis features for an enterprise" のコード サンプル

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,"advanced_security_enabled_new_user_namespace_repos":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.

To use this endpoint, you must be an administrator of the enterprise, and you must use an access token with the admin:enterprise scope.

"Enable or disable a security feature" のパラメーター

ヘッダー
名前, Type, 説明
accept string

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

パス パラメーター
名前, Type, 説明
enterprise string 必須

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

security_product string 必須

The security feature to enable or disable.

次のいずれかにできます: advanced_security, secret_scanning, secret_scanning_push_protection

enablement string 必須

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.

次のいずれかにできます: enable_all, disable_all

"Enable or disable a security feature" の HTTP 応答状態コード

状態コード説明
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

"Enable or disable a security feature" のコード サンプル

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