Skip to main content
ドキュメントには� �繁に更新が� えられ、その都度公開されています。本ページの翻訳はま� 未完成な部分があることをご了承く� さい。最新の情� �については、英語のドキュメンテーションをご参照く� さい。本ページの翻訳に問題がある� �合はこちらまでご連絡く� さい。

このバージョンの GitHub Enterprise はこの日付をもって終了となりました: 2022-06-03. 重大なセキュリティの問題に対してであっても、パッチリリースは作成されません。 パフォーマンスの向上、セキュリティの改善、新機能のためには、最新バージョンのGitHub Enterpriseにアップグレードしてく� さい。 アップグレードに関する支援については、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.

pre-receive 環境

pre-receive 環境 API を使用すると、pre-receive フックの環境を作成、一覧表示、更新、および削除できます。

認証されたサイト管理者のみが使用できます。通常のユーザがアクセスしようとすると、404 レスポンスを受け取ります。

オブジェクトの属性

pre-receive 環境

名前種類説明
namestringUI に表示される環境の名前。
image_urlstringダウンロードおよび抽出される tarball への URL。
default_environmentbooleanこれが GitHub Enterprise Server に同梱されるデフォルト環境かどうか。
downloadオブジェクトこの環境のダウンロードステータス。
hooks_countintegerこの環境を使用する pre-receive フックの数。

pre-receive 環境のダウンロード

名前種類説明
statestring最新のダウンロードの状態。
downloaded_atstring最新のダウンロードの開始時刻。
messagestring失敗時に、エラーメッセージが生成されます。

stateが取り得る値は、not_startedin_progresssuccessfailedです。

List pre-receive environments

パラメータ

Headers
名前, 種類, 説明
acceptstring

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

プレビューの通知を見る
クエリパラメータ
名前, 種類, 説明
per_pageinteger

The number of results per page (max 100).

デフォルト: 30

pageinteger

Page number of the results to fetch.

デフォルト: 1

directionstring

The direction to sort the results by.

デフォルト: desc

Can be one of: asc, desc

sortstring

デフォルト: created

Can be one of: created, updated, name

HTTP response status codes

Status code説明
200

OK

コードサンプル

get/admin/pre-receive-environments
curl \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token <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 } } ]

プレビュー通知

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

Create a pre-receive environment

パラメータ

Headers
名前, 種類, 説明
acceptstring

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

プレビューの通知を見る
Body parameters
名前, 種類, 説明
namestring必� �

The new pre-receive environment's name.

image_urlstring必� �

URL from which to download a tarball of this environment.

HTTP response status codes

Status code説明
201

Created

コードサンプル

post/admin/pre-receive-environments
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 } }

プレビュー通知

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

Get a pre-receive environment

パラメータ

Headers
名前, 種類, 説明
acceptstring

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

プレビューの通知を見る
Path parameters
名前, 種類, 説明
pre_receive_environment_idinteger必� �

The unique identifier of the pre-receive environment.

HTTP response status codes

Status code説明
200

OK

コードサンプル

get/admin/pre-receive-environments/{pre_receive_environment_id}
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

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 } }

プレビュー通知

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

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.

パラメータ

Headers
名前, 種類, 説明
acceptstring

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

プレビューの通知を見る
Path parameters
名前, 種類, 説明
pre_receive_environment_idinteger必� �

The unique identifier of the pre-receive environment.

Body parameters
名前, 種類, 説明
namestring

This pre-receive environment's new name.

image_urlstring

URL from which to download a tarball of this environment.

HTTP response status codes

Status code説明
200

OK

422

Client Errors

コードサンプル

patch/admin/pre-receive-environments/{pre_receive_environment_id}
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_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": "success", "downloaded_at": "2016-05-26T07:42:53-05:00", "message": null } }

プレビュー通知

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

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

パラメータ

Headers
名前, 種類, 説明
acceptstring

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

プレビューの通知を見る
Path parameters
名前, 種類, 説明
pre_receive_environment_idinteger必� �

The unique identifier of the pre-receive environment.

HTTP response status codes

Status code説明
204

No Content

422

Client Errors

コードサンプル

delete/admin/pre-receive-environments/{pre_receive_environment_id}
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_ID

Response

Status: 204

プレビュー通知

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

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

パラメータ

Headers
名前, 種類, 説明
acceptstring

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

プレビューの通知を見る
Path parameters
名前, 種類, 説明
pre_receive_environment_idinteger必� �

The unique identifier of the pre-receive environment.

HTTP response status codes

Status code説明
202

Accepted

422

Client Errors

コードサンプル

post/admin/pre-receive-environments/{pre_receive_environment_id}/downloads
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/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 }

プレビュー通知

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

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.

パラメータ

Headers
名前, 種類, 説明
acceptstring

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

プレビューの通知を見る
Path parameters
名前, 種類, 説明
pre_receive_environment_idinteger必� �

The unique identifier of the pre-receive environment.

HTTP response status codes

Status code説明
200

OK

コードサンプル

get/admin/pre-receive-environments/{pre_receive_environment_id}/downloads/latest
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/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 }

プレビュー通知

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