GitHub v3 REST API

Remove pre-receive hook enforcement for an organization

Removes any overrides for this hook at the org level for this org.

delete
{protocol}://{hostname}/api/v3/orgs/{org}/pre-receive-hooks/{pre_receive_hook_id}

Path Parameters

orgstringrequired
pre_receive_hook_idintegerrequired

pre_receive_hook_id parameter

Response

200 application/json

Response

org-pre-receive-hook

idinteger
namestring
enforcementstring
configuration_urlstring
allow_downstream_configurationboolean
delete/orgs/{org}/pre-receive-hooks/{pre_receive_hook_id}
 
200 application/json

List pre-receive hooks for a repository

List all pre-receive hooks that are enabled or testing for this repository as well as any disabled hooks that are allowed to be enabled at the repository level. Pre-receive hooks that are disabled at a higher level and are not configurable will not be listed.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/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

Allowed values:createdupdatedname

Default:created

Path Parameters

ownerstringrequired
repostringrequired

Response

200 application/json

Response

idinteger
namestring
enforcementstring
configuration_urlstring
get/repos/{owner}/{repo}/pre-receive-hooks
 
200 application/json

Get a pre-receive hook for a repository

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id}

Path Parameters

ownerstringrequired
repostringrequired
pre_receive_hook_idintegerrequired

pre_receive_hook_id parameter

Response

200 application/json

Response

repository-pre-receive-hook

idinteger
namestring
enforcementstring
configuration_urlstring
get/repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id}
 
200 application/json

Update pre-receive hook enforcement for a repository

For pre-receive hooks which are allowed to be configured at the repo level, you can set enforcement

patch
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id}

Path Parameters

ownerstringrequired
repostringrequired
pre_receive_hook_idintegerrequired

pre_receive_hook_id parameter

Body

application/json
enforcementstring

The state of enforcement for the hook on this repository.

Allowed values:enableddisabledtesting

Response

200 application/json

Response

repository-pre-receive-hook

idinteger
namestring
enforcementstring
configuration_urlstring
patch/repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id}

Body

{ "enforcement": "enabled" }
 
200 application/json

Remove pre-receive hook enforcement for a repository

Deletes any overridden enforcement on this repository for the specified hook.

Responds with effective values inherited from owner and/or global level.

delete
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id}

Path Parameters

ownerstringrequired
repostringrequired
pre_receive_hook_idintegerrequired

pre_receive_hook_id parameter

Response

200 application/json

Responds with effective values inherited from owner and/or global level.

repository-pre-receive-hook

idinteger
namestring
enforcementstring
configuration_urlstring
delete/repos/{owner}/{repo}/pre-receive-hooks/{pre_receive_hook_id}
 
200 application/json