Esta versão do GitHub Enterprise foi descontinuada em 2022-06-03. Nenhum lançamento de patch será feito, mesmo para questões críticas de segurança. Para obter melhor desempenho, melhorar a segurança e novos recursos, upgrade to the latest version of GitHub Enterprise. Para ajuda com a atualização, contact GitHub Enterprise support.
We've recently moved some of the REST API documentation. If you can't find what you're looking for, you might try the Actions REST API page.
Ambientes pre-receive
A API de Ambientes Pre-receive permite que você crie, liste, atualize e apague ambientes para hooks pre-receive.
Só está disponível para administradores do site autenticados. Usuários normais receberão uma mensagem 404 se tentarem acessá-la.
Atributos do objeto
Ambiente pre-receive
| Nome | Tipo | Descrição |
|---|---|---|
name | string | O nome do ambiente conforme exibido na interface do usuário. |
image_url | string | URL do tarball que será baixado e extraído. |
default_environment | boolean | Se este é o ambiente-padrão que vem com GitHub Enterprise Server. |
download | objeto | Status do download deste ambiente. |
hooks_count | inteiro | O número de hooks de pre-receive que usam este ambiente. |
Download do ambiente pre-receive
| Nome | Tipo | Descrição |
|---|---|---|
estado | string | O estado do download mais recente. |
downloaded_at | string | A hora em que o download mais recente começou. |
mensagem | string | Em caso de falha, serão produzidas mensagens de erro. |
Os valores possíveis para o estado são not_started, in_progress, sucesso falhado.
List pre-receive environments
Parâmetros
| Headers |
|---|
| Nome, Tipo, Descrição |
acceptstringSetting to |
| Parâmetros de consulta |
| Nome, Tipo, Descrição |
per_pageintegerThe number of results per page (max 100). Padrão: |
pageintegerPage number of the results to fetch. Padrão: |
directionstringThe direction to sort the results by. Padrão: Pode ser uma das ações a seguir: |
sortstringPadrão: Pode ser uma das ações a seguir: |
HTTP response status codes
| Status code | Descrição |
|---|---|
200 | OK |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/pre-receive-environmentsResponse
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
}
}
]Aviso de pré-visualização
APIs for managing pre-receive hooks are currently available for developers to preview. During the preview period, the APIs may change without advance notice.
To access the API you must provide a custom media type in the Accept header:
application/vnd.github.eye-scream-previewCreate a pre-receive environment
Parâmetros
| Headers |
|---|
| Nome, Tipo, Descrição |
acceptstringSetting to |
| Body parameters |
| Nome, Tipo, Descrição |
namestringObrigatórioThe new pre-receive environment's name. |
image_urlstringObrigatórioURL from which to download a tarball of this environment. |
HTTP response status codes
| Status code | Descrição |
|---|---|
201 | Created |
Amostras de código
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <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
}
}Aviso de pré-visualização
APIs for managing pre-receive hooks are currently available for developers to preview. During the preview period, the APIs may change without advance notice.
To access the API you must provide a custom media type in the Accept header:
application/vnd.github.eye-scream-previewGet a pre-receive environment
Parâmetros
| Headers |
|---|
| Nome, Tipo, Descrição |
acceptstringSetting to |
| Path parameters |
| Nome, Tipo, Descrição |
pre_receive_environment_idintegerObrigatórioThe unique identifier of the pre-receive environment. |
HTTP response status codes
| Status code | Descrição |
|---|---|
200 | OK |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_IDResponse
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
}
}Aviso de pré-visualização
APIs for managing pre-receive hooks are currently available for developers to preview. During the preview period, the APIs may change without advance notice.
To access the API you must provide a custom media type in the Accept header:
application/vnd.github.eye-scream-previewUpdate 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
| Headers |
|---|
| Nome, Tipo, Descrição |
acceptstringSetting to |
| Path parameters |
| Nome, Tipo, Descrição |
pre_receive_environment_idintegerObrigatórioThe unique identifier of the pre-receive environment. |
| Body parameters |
| Nome, Tipo, Descrição |
namestringThis pre-receive environment's new name. |
image_urlstringURL from which to download a tarball of this environment. |
HTTP response status codes
| Status code | Descrição |
|---|---|
200 | OK |
422 | Client Errors |
Amostras de código
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_IDResponse
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
}
}Aviso de pré-visualização
APIs for managing pre-receive hooks are currently available for developers to preview. During the preview period, the APIs may change without advance notice.
To access the API you must provide a custom media type in the Accept header:
application/vnd.github.eye-scream-previewDelete 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
| Headers |
|---|
| Nome, Tipo, Descrição |
acceptstringSetting to |
| Path parameters |
| Nome, Tipo, Descrição |
pre_receive_environment_idintegerObrigatórioThe unique identifier of the pre-receive environment. |
HTTP response status codes
| Status code | Descrição |
|---|---|
204 | No Content |
422 | Client Errors |
Amostras de código
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_IDResponse
Status: 204Aviso de pré-visualização
APIs for managing pre-receive hooks are currently available for developers to preview. During the preview period, the APIs may change without advance notice.
To access the API you must provide a custom media type in the Accept header:
application/vnd.github.eye-scream-previewStart 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
| Headers |
|---|
| Nome, Tipo, Descrição |
acceptstringSetting to |
| Path parameters |
| Nome, Tipo, Descrição |
pre_receive_environment_idintegerObrigatórioThe unique identifier of the pre-receive environment. |
HTTP response status codes
| Status code | Descrição |
|---|---|
202 | Accepted |
422 | Client Errors |
Amostras de código
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID/downloadsResponse
Status: 202{
"url": "https://github.example.com/api/v3/admin/pre-receive-environments/3/downloads/latest",
"state": "not_started",
"downloaded_at": null,
"message": null
}Aviso de pré-visualização
APIs for managing pre-receive hooks are currently available for developers to preview. During the preview period, the APIs may change without advance notice.
To access the API you must provide a custom media type in the Accept header:
application/vnd.github.eye-scream-previewGet 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
| Headers |
|---|
| Nome, Tipo, Descrição |
acceptstringSetting to |
| Path parameters |
| Nome, Tipo, Descrição |
pre_receive_environment_idintegerObrigatórioThe unique identifier of the pre-receive environment. |
HTTP response status codes
| Status code | Descrição |
|---|---|
200 | OK |
Amostras de código
curl \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <TOKEN>" \
http(s)://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID/downloads/latestResponse
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
}Aviso de pré-visualização
APIs for managing pre-receive hooks are currently available for developers to preview. During the preview period, the APIs may change without advance notice.
To access the API you must provide a custom media type in the Accept header:
application/vnd.github.eye-scream-preview