GitHub v3 REST API

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
post
{protocol}://{hostname}/api/v3/admin/pre-receive-environments/{pre_receive_environment_id}/downloads

Path Parameters

pre_receive_environment_idintegerrequired

Response

application/json

Response

pre-receive-environment-download-status

urlstring
statestring
downloaded_atstring | null
messagestring | null
post/admin/pre-receive-environments/{pre_receive_environment_id}/downloads
 
application/json

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
{protocol}://{hostname}/api/v3/admin/pre-receive-environments/{pre_receive_environment_id}/downloads/latest

Path Parameters

pre_receive_environment_idintegerrequired

Response

200 application/json

Response

pre-receive-environment-download-status

urlstring
statestring
downloaded_atstring | null
messagestring | null
get/admin/pre-receive-environments/{pre_receive_environment_id}/downloads/latest
 
200 application/json

List pre-receive hooks

get
{protocol}://{hostname}/api/v3/admin/pre-receive-hooks

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

directionstring

One of asc (ascending) or desc (descending).

Allowed values:ascdesc

Default:desc

sortstring

One of created (when the repository was starred) or updated (when it was last pushed to) or name.

Allowed values:createdupdatedname

Default:created

Response

200 application/json

Response

idinteger
namestring
enforcementstring
scriptstring
script_repositoryobject
Show Child Parameters
environmentobject
Show Child Parameters
allow_downstream_configurationboolean
get/admin/pre-receive-hooks
 
200 application/json

Create a pre-receive hook

post
{protocol}://{hostname}/api/v3/admin/pre-receive-hooks

Body

application/json
namestringrequired

The name of the hook.

scriptstringrequired

The script that the hook runs.

script_repositoryobjectrequired

The GitHub repository where the script is kept.

* Additional properties are allowed.
environmentobjectrequired

The pre-receive environment where the script is executed.

* Additional properties are allowed.
enforcementstring

The state of enforcement for this hook. default: disabled

allow_downstream_configurationboolean

Whether enforcement can be overridden at the org or repo level. default: false

Response

201 application/json

Response

pre-receive-hook

idinteger
namestring
enforcementstring
scriptstring
script_repositoryobject
Show Child Parameters
environmentobject
Show Child Parameters
allow_downstream_configurationboolean
post/admin/pre-receive-hooks

Body

{ "name": "Check Commits", "script": "scripts/commit_check.sh", "enforcement": "disabled", "allow_downstream_configuration": false, "script_repository": { "full_name": "DevIT/hooks" }, "environment": { "id": 2 } }
 
201 application/json

Get a pre-receive hook

get
{protocol}://{hostname}/api/v3/admin/pre-receive-hooks/{pre_receive_hook_id}

Path Parameters

pre_receive_hook_idintegerrequired

pre_receive_hook_id parameter

Response

200 application/json

Response

pre-receive-hook

idinteger
namestring
enforcementstring
scriptstring
script_repositoryobject
Show Child Parameters
environmentobject
Show Child Parameters
allow_downstream_configurationboolean
get/admin/pre-receive-hooks/{pre_receive_hook_id}
 
200 application/json