Skip to main content

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.

Después de que un administrador del sitio actualice la instancia de Enterprise Server a Enterprise Server 3.9 o posterior, la API de REST tendrá control de versiones. Para informarte sobre cómo encontrar la versión de tu instancia, consulta "Acerca de las versiones de GitHub Docs". Para obtener más información, consulta "Acerca del control de versiones de la API".

Puntos de conexión de API de REST para entornos previos a la recepción

Usa la API REST para crear, enumerar, actualizar y eliminar entornos para los enlaces previos a la recepción.

Acerca de los entornos previos a la recepción

Estos puntos de conexión solo están disponibles para los administradores de sitios autenticados. Los usuarios normales recibirán una respuesta 404.

Atributos de objeto

Ambiente de pre-recepción

NombreEscribirDescripción
namestringEl nombre del ambiente como se muestra en la IU.
image_urlstringLa URL del tarball que se descargará y extraerá.
default_environmentbooleanSi este es el ambiente predeterminado que viene con GitHub Enterprise Server o no.
downloadobjectEl estado de descarga de este ambiente.
hooks_countintegerLa cantidad de ganchos de pre-recepción que utilizan este ambiente.

Descarga del Ambiente de Pre-recepción

NombreEscribirDescripción
statestringEl estado de la mayoría de las descargas recientes.
downloaded_atstringLa hora en la cual iniciaron la mayoría de las descrgas recientes.
messagestringCuando algo falla, este tendrá cualquier mensaje de error que se haya producido.

Los valores posibles de state son: not_started, in_progress, success y failed.

List pre-receive environments

Parámetros para "List pre-receive environments"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de consulta
Nombre, Tipo, Descripción
per_page integer

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

Valor predeterminado: 30

page integer

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

Valor predeterminado: 1

direction string

The direction to sort the results by.

Valor predeterminado: desc

Puede ser uno de los siguientes: asc, desc

sort string

Valor predeterminado: created

Puede ser uno de los siguientes: created, updated, name

Códigos de estado de respuesta HTTP para "List pre-receive environments"

status codeDescripción
200

OK

Ejemplos de código para "List pre-receive environments"

Ejemplo de solicitud

get/admin/pre-receive-environments
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/pre-receive-environments

Response

Status: 200
[ { "id": 1, "name": "Default", "image_url": "githubenterprise://internal", "url": "https://github.example.com/api/v3/admin/pre-receive-environments/1", "html_url": "https://github.example.com/admin/pre-receive-environments/1", "default_environment": true, "created_at": "2016-05-20T11:35:45-05:00", "hooks_count": 14, "download": { "url": "https://github.example.com/api/v3/admin/pre-receive-environments/1/downloads/latest", "state": "not_started", "downloaded_at": "2016-05-26T07:42:53-05:00", "message": null } }, { "id": 2, "name": "DevTools Hook Env", "image_url": "https://my_file_server/path/to/devtools_env.tar.gz", "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2", "html_url": "https://github.example.com/admin/pre-receive-environments/2", "default_environment": false, "created_at": "2016-05-20T11:35:45-05:00", "hooks_count": 1, "download": { "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2/downloads/latest", "state": "success", "downloaded_at": "2016-05-26T07:42:53-05:00", "message": null } } ]

Create a pre-receive environment

Parámetros para "Create a pre-receive environment"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros del cuerpo
Nombre, Tipo, Descripción
name string Requerido

The new pre-receive environment's name.

image_url string Requerido

URL from which to download a tarball of this environment.

Códigos de estado de respuesta HTTP para "Create a pre-receive environment"

status codeDescripción
201

Created

Ejemplos de código para "Create a pre-receive environment"

Ejemplo de solicitud

post/admin/pre-receive-environments
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/pre-receive-environments \ -d '{"name":"DevTools Hook Env","image_url":"https://my_file_server/path/to/devtools_env.tar.gz"}'

Response

Status: 201
{ "id": 2, "name": "DevTools Hook Env", "image_url": "https://my_file_server/path/to/devtools_env.tar.gz", "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2", "html_url": "https://github.example.com/admin/pre-receive-environments/2", "default_environment": false, "created_at": "2016-05-20T11:35:45-05:00", "hooks_count": 1, "download": { "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2/downloads/latest", "state": "not_started", "downloaded_at": null, "message": null } }

Get a pre-receive environment

Parámetros para "Get a pre-receive environment"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
pre_receive_environment_id integer Requerido

The unique identifier of the pre-receive environment.

Códigos de estado de respuesta HTTP para "Get a pre-receive environment"

status codeDescripción
200

OK

Ejemplos de código para "Get a pre-receive environment"

Ejemplo de solicitud

get/admin/pre-receive-environments/{pre_receive_environment_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID

Response

Status: 200
{ "id": 2, "name": "DevTools Hook Env", "image_url": "https://my_file_server/path/to/devtools_env.tar.gz", "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2", "html_url": "https://github.example.com/admin/pre-receive-environments/2", "default_environment": false, "created_at": "2016-05-20T11:35:45-05:00", "hooks_count": 1, "download": { "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2/downloads/latest", "state": "not_started", "downloaded_at": null, "message": null } }

Update a pre-receive environment

You cannot modify the default environment. If you attempt to modify the default environment, you will receive a 422 Unprocessable Entity response.

Parámetros para "Update a pre-receive environment"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
pre_receive_environment_id integer Requerido

The unique identifier of the pre-receive environment.

Parámetros del cuerpo
Nombre, Tipo, Descripción
name string

This pre-receive environment's new name.

image_url string

URL from which to download a tarball of this environment.

Códigos de estado de respuesta HTTP para "Update a pre-receive environment"

status codeDescripción
200

OK

422

Client Errors

Ejemplos de código para "Update a pre-receive environment"

Ejemplo de solicitud

patch/admin/pre-receive-environments/{pre_receive_environment_id}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID \ -d '{"name":"DevTools Hook Env","image_url":"https://my_file_server/path/to/devtools_env.tar.gz"}'

Response

Status: 200
{ "id": 2, "name": "DevTools Hook Env", "image_url": "https://my_file_server/path/to/devtools_env.tar.gz", "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2", "html_url": "https://github.example.com/admin/pre-receive-environments/2", "default_environment": false, "created_at": "2016-05-20T11:35:45-05:00", "hooks_count": 1, "download": { "url": "https://github.example.com/api/v3/admin/pre-receive-environments/2/downloads/latest", "state": "success", "downloaded_at": "2016-05-26T07:42:53-05:00", "message": null } }

Delete a pre-receive environment

If you attempt to delete an environment that cannot be deleted, you will receive a 422 Unprocessable Entity response.

The possible error messages are:

  • Cannot modify or delete the default environment
  • Cannot delete environment that has hooks
  • Cannot delete environment when download is in progress

Parámetros para "Delete a pre-receive environment"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
pre_receive_environment_id integer Requerido

The unique identifier of the pre-receive environment.

Códigos de estado de respuesta HTTP para "Delete a pre-receive environment"

status codeDescripción
204

No Content

422

Client Errors

Ejemplos de código para "Delete a pre-receive environment"

Ejemplo de solicitud

delete/admin/pre-receive-environments/{pre_receive_environment_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID

Response

Status: 204

Start a pre-receive environment download

Triggers a new download of the environment tarball from the environment's image_url. When the download is finished, the newly downloaded tarball will overwrite the existing environment.

If a download cannot be triggered, you will receive a 422 Unprocessable Entity response.

The possible error messages are:

  • Cannot modify or delete the default environment
  • Can not start a new download when a download is in progress

Parámetros para "Start a pre-receive environment download"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
pre_receive_environment_id integer Requerido

The unique identifier of the pre-receive environment.

Códigos de estado de respuesta HTTP para "Start a pre-receive environment download"

status codeDescripción
202

Accepted

422

Client Errors

Ejemplos de código para "Start a pre-receive environment download"

Ejemplo de solicitud

post/admin/pre-receive-environments/{pre_receive_environment_id}/downloads
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID/downloads

Response

Status: 202
{ "url": "https://github.example.com/api/v3/admin/pre-receive-environments/3/downloads/latest", "state": "not_started", "downloaded_at": null, "message": null }

Get the download status for a pre-receive environment

In addition to seeing the download status at the "Get a pre-receive environment" endpoint, there is also this separate endpoint for just the download status.

Parámetros para "Get the download status for a pre-receive environment"

Encabezados
Nombre, Tipo, Descripción
accept string

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

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
pre_receive_environment_id integer Requerido

The unique identifier of the pre-receive environment.

Códigos de estado de respuesta HTTP para "Get the download status for a pre-receive environment"

status codeDescripción
200

OK

Ejemplos de código para "Get the download status for a pre-receive environment"

Ejemplo de solicitud

get/admin/pre-receive-environments/{pre_receive_environment_id}/downloads/latest
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID/downloads/latest

Response

Status: 200
{ "url": "https://github.example.com/api/v3/admin/pre-receive-environments/3/downloads/latest", "state": "success", "downloaded_at": "2016-05-26T07:42:53-05:00", "message": null }