Esta versión de GitHub Enterprise Server se discontinuó el 2024-03-26. No se realizarán lanzamientos de patch, ni siquiera para problemas de seguridad críticos. Para obtener rendimiento mejorado, seguridad mejorada y nuevas características, actualice a la versión más reciente de GitHub Enterprise Server. Para obtener ayuda con la actualización, póngase en contacto con el soporte técnico de GitHub Enterprise.
Puntos de conexión de API de REST para la seguridad y el análisis del código empresarial
Usa la API REST para administrar las características de análisis y seguridad de código de tu empresa.
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.
Parámetros para "Get code security and analysis features for an enterprise"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
enterprise string RequeridoThe slug version of the enterprise name. You can also substitute this value with the enterprise id. |
Códigos de estado de respuesta HTTP para "Get code security and analysis features for an enterprise"
status code | Descripción |
---|---|
200 | OK |
404 | Resource not found |
Ejemplos de código para "Get code security and analysis features for an enterprise"
Ejemplo de solicitud
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.
Parámetros para "Update code security and analysis features for an enterprise"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
enterprise string RequeridoThe slug version of the enterprise name. You can also substitute this value with the enterprise id. |
Nombre, Tipo, Descripción |
---|
dependabot_alerts_enabled_for_new_repositories boolean Whether Dependabot alerts are automatically enabled for new repositories. For more information, see "About Dependabot alerts." |
Códigos de estado de respuesta HTTP para "Update code security and analysis features for an enterprise"
status code | Descripción |
---|---|
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 |
Ejemplos de código para "Update code security and analysis features for an enterprise"
Ejemplo de solicitud
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.
Parámetros para "Enable or disable a security feature"
Nombre, Tipo, Descripción |
---|
accept string Setting to |
Nombre, Tipo, Descripción |
---|
enterprise string RequeridoThe slug version of the enterprise name. You can also substitute this value with the enterprise id. |
security_product string RequeridoThe security feature to enable or disable. Puede ser uno de los siguientes: |
enablement string RequeridoThe action to take.
Puede ser uno de los siguientes: |
Códigos de estado de respuesta HTTP para "Enable or disable a security feature"
status code | Descripción |
---|---|
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 |
Ejemplos de código para "Enable or disable a security feature"
Ejemplo de solicitud
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