GitHub v3 REST API

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

Update a pre-receive hook

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

Path Parameters

pre_receive_hook_idintegerrequired

pre_receive_hook_id parameter

Body

application/json
namestring

The name of the hook.

scriptstring

The script that the hook runs.

script_repositoryobject

The GitHub repository where the script is kept.

* Additional properties are allowed.
environmentobject

The pre-receive environment where the script is executed.

* Additional properties are allowed.
enforcementstring

The state of enforcement for this hook.

allow_downstream_configurationboolean

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

Response

200 application/json

Response

pre-receive-hook

idinteger
namestring
enforcementstring
scriptstring
script_repositoryobject
Show Child Parameters
environmentobject
Show Child Parameters
allow_downstream_configurationboolean
patch/admin/pre-receive-hooks/{pre_receive_hook_id}

Body

{ "name": "Check Commits", "environment": { "id": 1 }, "allow_downstream_configuration": true }
 
200 application/json