Updated on 2023-06-25 GMT+08:00

Creating a Project Hook

Function

This API is used to create a project hook.

URI

POST /v1/{project_id}/git/repos/{namespace}/{project}/hooks

Table 1 describes the parameters.

Table 1 Path parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Tenant's project ID.

namespace

String

Yes

Namespace ID or URL code name.

project

String

Yes

Repository project ID or URL code name. If the value contains a slash (/), replace it with a colon (:).

Request

Request parameters

Table 2 Request parameters

Parameter

Type

Mandatory

Description

secret

String

Yes

Character string used to verify received payloads.

url

String

Yes

URL that is called back when a hook is triggered.

Response

Response parameters

Table 3 Response parameters

Parameter

Type

Description

id

String

Hook ID.

type

String

Hook type.

callback_url

String

Callback URL.

Example

Example request

{
  "secret": "string",
  "url": "string"
}

Example response

{
  "id": "string",
  "type": "string",
  "callback_url": "string"
}

Status Code

Table 4 Status codes

Status Code

Description

200

OK

400

Bad Request

Error Code

Error code must be in the format of SVCSTG.REPO.[Error_ID]. Example: SVCSTG.REPO.0401. See ServiceStage Error Codes.