外观
修改通知地址
PATCH /webhooks/{webhookId}
| 权限范围 | 幂等 | operationId |
|---|---|---|
webhooks:manage | 本身幂等 | Webhooks_update |
只传要改的字段;enabled: true 会同时清零失败计数。
幂等:本身幂等,重复调用结果相同。
参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
webhookId | 路径 | string | 是 | 通知地址 ID(wh_…) |
请求体
UpdateWebhook
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
url | string | 地址(≤512 字) | |
eventTypes | string[] | 订阅的事件类型;["*"] = 全部(最多 50 项) | |
description | string | 说明(≤100 字) | |
enabled | boolean | 是否启用 |
示例
js
const res = await client.patch("/webhooks/wh_1CcCZKQvkWWEgAfxpMOQNIQ", {
"url": "https://example.com/sy-webhook",
"eventTypes": [
"string"
],
"description": "说明文字",
"enabled": true
});http
PATCH /open/v1/webhooks/wh_1CcCZKQvkWWEgAfxpMOQNIQ HTTP/1.1
Host: api.sybb.pw
Authorization: SY-HMAC-SHA256 Credential=ak_…, Timestamp=1796035200, Nonce=…, Signature=…
Content-Type: application/json
{
"url": "https://example.com/sy-webhook",
"eventTypes": [
"string"
],
"description": "说明文字",
"enabled": true
}响应 200:
json
{
"webhookId": "wh_1CcCZKQvkWWEgAfxpMOQNIQ",
"url": "https://example.com/sy-webhook",
"eventTypes": [
"string"
],
"description": "说明文字",
"status": "enabled",
"consecutiveFailures": 1,
"secret": "string",
"createdAt": "2026-11-30T20:15:00+08:00"
}响应
WebhookView
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
webhookId | string | 通知地址 ID(wh_…) | |
url | string | 地址 | |
eventTypes | string[] | 订阅的事件类型;["*"] = 全部 | |
description | string | 说明 | |
status | string | enabled / disabled / auto_disabled(连续 3 天全部失败被系统停用) | |
consecutiveFailures | integer | 连续投递失败次数(成功一次清零;连续失败 3 天自动停用) | |
secret | string | 只在创建和轮换时返回 | |
createdAt | string | 时间(RFC 3339) |
错误
| HTTP | 错误码 | 含义 |
|---|---|---|
| 404 | NOT_FOUND | 资源不存在或不属于本店 |
签名、权限、限流等通用错误见错误处理。