최근에 REST API 설명서 중 일부를 이동했습니다. 원하는 항목을 찾을 수 없는 경우 작업 REST API 페이지를 사용해 볼 수 있습니다.
사전 수신 환경
REST API를 사용하여 사전 수신 후크에 대한 환경을 만들고 나열하고 업데이트하고 삭제합니다.
About pre-receive environments
These endpoints are only available to authenticated site administrators. Normal users will receive a 404
response.
Object attributes
Pre-receive Environment
Name | Type | Description |
---|---|---|
name | string | The name of the environment as displayed in the UI. |
image_url | string | URL to the tarball that will be downloaded and extracted. |
default_environment | boolean | Whether this is the default environment that ships with GitHub AE. |
download | object | This environment's download status. |
hooks_count | integer | The number of pre-receive hooks that use this environment. |
Pre-receive Environment Download
Name | Type | Description |
---|---|---|
state | string | The state of the most recent download. |
downloaded_at | string | The time when the most recent download started. |
message | string | On failure, this will have any error messages produced. |
Possible values for state
are not_started
, in_progress
, success
, failed
.
List pre-receive environments
"List pre-receive environments"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
per_page integer The number of results per page (max 100). 기본값: |
page integer Page number of the results to fetch. 기본값: |
direction string The direction to sort the results by. 기본값: 다음 중 하나일 수 있습니다.: |
sort string 기본값: 다음 중 하나일 수 있습니다.: |
"List pre-receive environments"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
"List pre-receive environments"에 대한 코드 샘플
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://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
"Create a pre-receive environment"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
name string RequiredThe new pre-receive environment's name. |
image_url string RequiredURL from which to download a tarball of this environment. |
"Create a pre-receive environment"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
201 | Created |
"Create a pre-receive environment"에 대한 코드 샘플
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://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
"Get a pre-receive environment"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
pre_receive_environment_id integer RequiredThe unique identifier of the pre-receive environment. |
"Get a pre-receive environment"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
"Get a pre-receive environment"에 대한 코드 샘플
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://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.
"Update a pre-receive environment"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
pre_receive_environment_id integer RequiredThe unique identifier of the pre-receive environment. |
이름, Type, 설명 |
---|
name string This pre-receive environment's new name. |
image_url string URL from which to download a tarball of this environment. |
"Update a pre-receive environment"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
422 | Client Errors |
"Update a pre-receive environment"에 대한 코드 샘플
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://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
"Delete a pre-receive environment"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
pre_receive_environment_id integer RequiredThe unique identifier of the pre-receive environment. |
"Delete a pre-receive environment"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
204 | No Content |
422 | Client Errors |
"Delete a pre-receive environment"에 대한 코드 샘플
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://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
"Start a pre-receive environment download"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
pre_receive_environment_id integer RequiredThe unique identifier of the pre-receive environment. |
"Start a pre-receive environment download"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
202 | Accepted |
422 | Client Errors |
"Start a pre-receive environment download"에 대한 코드 샘플
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID/downloads
Response
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.
"Get the download status for a pre-receive environment"에 대한 매개 변수
이름, Type, 설명 |
---|
accept string Setting to |
이름, Type, 설명 |
---|
pre_receive_environment_id integer RequiredThe unique identifier of the pre-receive environment. |
"Get the download status for a pre-receive environment"에 대한 HTTP 응답 상태 코드
상태 코드 | 설명 |
---|---|
200 | OK |
"Get the download status for a pre-receive environment"에 대한 코드 샘플
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://HOSTNAME/api/v3/admin/pre-receive-environments/PRE_RECEIVE_ENVIRONMENT_ID/downloads/latest
Response