Skip to main content

이 버전의 GitHub Enterprise는 다음 날짜에 중단되었습니다. 2024-03-26. 중요한 보안 문제에 대해서도 패치 릴리스가 이루어지지 않습니다. 더 뛰어난 성능, 향상된 보안, 새로운 기능을 위해 최신 버전의 GitHub Enterprise Server로 업그레이드합니다. 업그레이드에 대한 도움말은 GitHub Enterprise 지원에 문의하세요.

사이트 관리자가 Enterprise Server 인스턴스를 Enterprise Server 3.9 이상으로 업그레이드하면 REST API의 버전이 지정됩니다. 인스턴스의 버전을 찾는 방법을 알아보려면 "GitHub Docs 버전 정보"를 참조하세요. 자세한 내용은 "API 버전 관리 정보"를 참조하세요.

사전 수신 환경에 대한 REST API 엔드포인트

REST API를 사용하면 사전 수신 후크에 대한 환경을 만들고, 나열하고, 업데이트하고, 삭제할 수 있습니다.

사전 수신 환경 정보보

이러한 엔드포인트는 인증된 사이트 관리자만 사용할 수 있습니다. 일반 사용자는 404 응답을 받게 됩니다.

개체 특성

사전 수신 환경

이름형식설명
namestringUI에 표시되는 환경 이름입니다.
image_urlstring다운로드하고 추출할 tarball의 URL입니다.
default_environmentbooleanGitHub Enterprise Server와 함께 제공되는 기본 환경인지 여부입니다.
downloadobject이 환경의 다운로드 상태입니다.
hooks_countinteger이 환경을 사용하는 사전 수신 후크 수입니다.

사전 수신 환경 다운로드

이름형식설명
statestring가장 최근 다운로드의 상태입니다.
downloaded_atstring가장 최근 다운로드가 시작된 시간입니다.
messagestring오류 발생 시 생성된 오류 메시지입니다.

state의 가능한 값은 not_started, in_progress, success, failed입니다.

List pre-receive environments

"List pre-receive environments"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

쿼리 매개 변수
이름, Type, 설명
per_page integer

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

기본값: 30

page integer

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

기본값: 1

direction string

The direction to sort the results by.

기본값: desc

다음 중 하나일 수 있습니다.: asc, desc

sort string

기본값: created

다음 중 하나일 수 있습니다.: created, updated, name

"List pre-receive environments"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

"List pre-receive environments"에 대한 코드 샘플

요청 예제

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

"Create a pre-receive environment"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

본문 매개 변수
이름, Type, 설명
name string Required

The new pre-receive environment's name.

image_url string Required

URL from which to download a tarball of this environment.

"Create a pre-receive environment"에 대한 HTTP 응답 상태 코드

상태 코드설명
201

Created

"Create a pre-receive environment"에 대한 코드 샘플

요청 예제

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

"Get a pre-receive environment"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

경로 매개 변수
이름, Type, 설명
pre_receive_environment_id integer Required

The unique identifier of the pre-receive environment.

"Get a pre-receive environment"에 대한 HTTP 응답 상태 코드

상태 코드설명
200

OK

"Get a pre-receive environment"에 대한 코드 샘플

요청 예제

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.

"Update a pre-receive environment"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

경로 매개 변수
이름, Type, 설명
pre_receive_environment_id integer Required

The 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"에 대한 코드 샘플

요청 예제

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

"Delete a pre-receive environment"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

경로 매개 변수
이름, Type, 설명
pre_receive_environment_id integer Required

The unique identifier of the pre-receive environment.

"Delete a pre-receive environment"에 대한 HTTP 응답 상태 코드

상태 코드설명
204

No Content

422

Client Errors

"Delete a pre-receive environment"에 대한 코드 샘플

요청 예제

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

"Start a pre-receive environment download"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

경로 매개 변수
이름, Type, 설명
pre_receive_environment_id integer Required

The 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"에 대한 코드 샘플

요청 예제

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.

"Get the download status for a pre-receive environment"에 대한 매개 변수

헤더
이름, Type, 설명
accept string

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

경로 매개 변수
이름, Type, 설명
pre_receive_environment_id integer Required

The 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"에 대한 코드 샘플

요청 예제

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 }