通过 OpenAPI 更新 WebHook。
适用版本 | 中心版、Region版 |
服务接入点与授权信息
产品 | 资源 | 所需权限 |
代码管理 | WebHook | 读写 |
请求语法
中心版
PUT https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/webhooks/{hookId}
Region版
PUT https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/webhooks/{hookId}
请求头
参数 | 类型 | 是否必填 | 描述 | 示例值 |
x-yunxiao-token | string | 是 | 个人访问令牌。 | pt-0fh3****0fbG_35af****0484 |
请求参数
参数 | 类型 | 位置 | 是否必填 | 描述 | 示例值 |
organizationId | string | path |
| 组织 ID。 | 60d54f3daccf2bbd6659f3ad |
repositoryId | string | path | 是 | 代码库 ID 或者 URL-Encoder 编码的全路径。 | 2813489或者60de7a6852743a5162b5f957%2FDemoRepo |
hookId | integer | path | 是 | WebHook 主键 ID。 | 1 |
| - | object | body | 否 | ||
| description | string | body | 否 | WebHook 描述。 | 描述内容 |
| enableSslVerification | boolean | body | 否 | 是否使用 SSL 认证。 | false |
| mergeRequestsEvents | boolean | body | 否 | 合并请求事件。 | true |
| noteEvents | boolean | body | 否 | 评论事件。 | true |
| pushEvents | boolean | body | 否 | 推送事件。 | true |
| tagPushEvents | boolean | body | 否 | 标签推送事件。 | true |
| token | string | body | 否 | 用于验证身份的 token,用户自定义。 | xxx |
| url | string | body | 是 | WebHook 链接,一般不超过1024个字符。 | http://example/example |
请求示例
中心版
curl -X 'PUT' \
'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489或者60de7a6852743a5162b5f957%2FDemoRepo/webhooks/1' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"description": "描述内容",
"enableSslVerification": false,
"mergeRequestsEvents": true,
"noteEvents": true,
"pushEvents": true,
"tagPushEvents": true,
"token": "xxx",
"url": "http://example/example"
}'
Region版
curl -X 'PUT' \
'https://{domain}/oapi/v1/codeup/repositories/2813489或者60de7a6852743a5162b5f957%2FDemoRepo/webhooks/1' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"description": "描述内容",
"enableSslVerification": false,
"mergeRequestsEvents": true,
"noteEvents": true,
"pushEvents": true,
"tagPushEvents": true,
"token": "xxx",
"url": "http://example/example"
}'
返回参数
参数 | 类型 | 描述 | 示例值 |
| - | object | ||
| createdAt | string | 创建时间。 | 2024-10-05T15:30:45Z |
| description | string | Webhook 描述信息。 | 描述内容 |
| enableSSLVerification | boolean | 是否开启 SSL 认证。 | false |
| id | integer | Webhook 主键 ID。 | 1 |
| mergeRequestEvents | boolean | 合并请求事件。 | true |
| noteEvents | boolean | 评论事件。 | true |
| pushEvents | boolean | 代码推送事件。 | true |
| repositoryId | integer | 代码库 ID。 | 1 |
| tagPushEvents | boolean | 标签推送事件。 | true |
| token | string | 用于验证身份的 token,用户自定义。 | xxx |
| updatedAt | string | 更新时间。 | 2024-10-05T15:30:45Z |
| url | string | Webhook 链接。 | http://example/example |
返回示例
{
"createdAt": "2024-10-05T15:30:45Z",
"description": "描述内容",
"enableSSLVerification": false,
"id": 1,
"mergeRequestEvents": true,
"noteEvents": true,
"pushEvents": true,
"repositoryId": 1,
"tagPushEvents": true,
"token": "xxx",
"updatedAt": "2024-10-05T15:30:45Z",
"url": "http://example/example"
}
错误码
访问错误码中心查看 API 相关错误码。