Obtaining the Webhook List Under a Project
Function
This API is used to obtain the webhook list under a project.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET https://{hostURL}/v4/projects/{project_id}/hooks
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: You can obtain the unique project identifier, 32-character UUID, by calling the API used to query the project list. Value range: 32 characters |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| offset | No | Integer | Definition Offset, which starts from 0. Value range: 0~2147483647 Default value: 0 |
| limit | No | Integer | Definition Number of returned records. Value range: 1~100 Default value: 20 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. Obtain a token by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Constraints Mandatory. Range 1–100,000 characters. Default Value N/A. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| X-Total | String | Definition Total number of results of the current request. |
| Parameter | Type | Description |
|---|---|---|
| [items] | Array of WebhookDto objects | Definition Webhook data. |
| Parameter | Type | Description |
|---|---|---|
| url | String | Definition Webhook URL. Range Mandatory. Max. 500 characters. |
| push_events | Boolean | Definition Whether to enable the push event. |
| push_events_branch_regex_filter | String | Definition Regular expression for push event branches filtering. Range Mandatory. Max. 500 characters. |
| tag_push_events | Boolean | Definition Whether to enable the tag push event. |
| merge_requests_events | Boolean | Definition Whether to enable the MR event. |
| note_events | Boolean | Definition Whether to enable the comment event. |
| token | String | Definition Token value. When it is used as the return value, the mask is used to replace the actual value. Range Mandatory. Max. 2,000 characters. |
| token_type | String | Definition Token type. The default value is X-Repo-Token. Range Mandatory. Max. 200 characters. |
| name | String | Definition Name. Range Mandatory. Max. 200 characters. |
| description | String | Definition Description. Range Mandatory. Max. 200 characters. |
| id | Integer | Definition Webhook ID. Value range: 1~2147483647 |
| created_at | String | Definition Creation time. Definition yyyy-MM-dd'T'HH:mm:ss.SSSXXX |
| updated_at | String | Definition Update time. Definition yyyy-MM-dd'T'HH:mm:ss.SSSXXX |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. |
| error_msg | String | Definition Error message. |
Example Requests
GET https://{endpoint}/v4/projects/a642c851d4dc4853b595e5c8a5e56df7/hooks Example Responses
Status code: 200
OK
[ {
"id" : 1,
"url" : "https://demo.com",
"push_events" : true,
"push_events_branch_regex_filter" : ".*",
"tag_push_events" : true,
"merge_requests_events" : false,
"note_events" : false,
"token" : "",
"token_type" : "X-Repo-Token",
"name" : "Code check",
"description" : "Code check",
"created_at" : "2024-10-15T22:30:24.000+08:00",
"updated_at" : "2024-10-15T22:30:24.000+08:00"
}, {
"id" : 2,
"url" : "https://demo1.com",
"push_events" : true,
"push_events_branch_regex_filter" : ".*",
"tag_push_events" : true,
"merge_requests_events" : false,
"note_events" : false,
"token" : "************",
"token_type" : "X-Repo-Token",
"name" : "Code check",
"description" : "Code check",
"created_at" : "2024-10-15T22:30:24.000+08:00",
"updated_at" : "2024-10-15T22:30:24.000+08:00"
} ] Status code: 401
Unauthorized
{
"error_code" : "DEV.00000003",
"error_msg" : "Authentication information expired."
} Status code: 403
Bad Request
{
"error_code" : "CH.004403",
"error_msg" : "Insufficient permissions. Apply for the required permissions and try again."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Unauthorized |
| 403 | Bad Request |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.