CDN Pro
更新webhook接口。只有请求体中携带的字段才会被更新。
Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试
参数名称 | 描述 |
---|---|
*idString | webhook接口id。 |
参数名称 | 描述 |
---|---|
nameString | 取值范围: <= 250 字符
webhook接口名称。 |
descriptionString | 取值范围: <= 500 字符
webhook接口描述。 |
urlString | 取值范围: <= 250 字符
当关联的异步任务执行完成时,需触发的webhook接口的地址。CDN Pro将使用HTTP POST方法调webhook接口,请求体为JSON格式。请求体示例:
{ 'subject': '{some text}',
'taskType': '{task type}',
'taskList': [
{ 'taskId': '{task id 1}',
...
},
{ 'taskId': '{task id 2}',
...
}
]
}
|
credentialsObject | 用于鉴权的账号信息。当您的服务器有鉴权要求时,需支持HTTP Basic鉴权方式。CDN Pro将用当前日期对secretKey进行加密,生成密码(password)。 |
userString | 用于鉴权的用户名。 |
secretKeyString | 用于鉴权的密钥。CDN Pro将用当期日期对密钥进行加密生成密码(password),然后通过Authorization请求头传给你方服务器。 |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
204 | The webhook was successfully updated. | 204 | webhook更新成功。 |
404 | The specified webhook ID does not exist. | 404 | 指定的webhook ID 不存在。 |
#!/bin/bash username="example_username" apiKey="example_apiKey" date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"` password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64` curl -i --url "https://open.chinanetcenter.com/cdn/webhooks/{webhookID}" \ -X "PATCH" \ -u "$username:$password" \ -H "Date: $date" \ -H "Accept: application/json" \ -d '{"name": "mywebhook", "description": "This webhook notifies when a deployment completes.", "url": "https://www.mydomain.com/notify"}'
{ "code": "InvalidWebhookId", "message": "The specified webhook ID does not exist." }