Subversion Edge Repository Hook Scripts API

Use this API to post a new hook script for a repository or replace an existing one.

This API is available with Subversion Edge 2.3.0 (and later).
Note: The following examples show request bodies and responses in JSON format, but XML is equally valid.

GET

HTTP method and URL
GET /csvn/api/1/hook/{repoId}

GET /csvn/api/1/hook/2?format=json&sort=date&order=desc
Parameters
scriptName
Optional. When the URL path contains a script name, the response includes the file's contents. ASCII files have a "text/plain" mime-type. All other files, including non-ASCII encoded text files, are sent as "application/octet-stream".

Example:

GET /csvn/api/1/hook/{repoId}/{scriptName}

GET /csvn/api/1/hook/2/pre-commit
Authentication / Authorization Repository hooks administrators (ROLE_ADMIN_HOOK) and the super user (ROLE_ADMIN)
Response GET retrieves the list of repositories in the directory where the repository's hook scripts are located. Sub-directories are not included. The repoId field after the "hook" token refers to the repository.

Example:

PUT

Use the PUT method to create new hook scripts and update existing ones. The URL path provides the metadata about the binary or plain text file in the request body. The repoId field after the "hook" token refers to the repository in which the scriptName will be created or replaced by the request body content.
HTTP method and URL
PUT /csvn/api/1/hook/{repoId}/{scriptName}            
            
PUT /csvn/api/1/hook/2/pre-commit?format=json
Authentication / Authorization Repository hooks administrators (ROLE_ADMIN_HOOK) and the super user (ROLE_ADMIN)
Response The response indicates success or failure through the status code and message.

Example:

DELETE

Use the DELETE method to remove files from a repository's hooks directory. Path parameters are the same as in the PUT method.
HTTP method and URL
DELETE /csvn/api/1/hook/{repoId}/{scriptName}            
            
DELETE /csvn/api/1/hook/2/pre-commit?format=json
Authentication / Authorization Repository hooks administrators (ROLE_ADMIN_HOOK) and the super user (ROLE_ADMIN)
Response The response indicates success or failure through the status code and message.

Example: