Webhooks
获取 Webhook 列表
获取你账户上注册的所有 Webhook 端点,可按状态筛选以查找启用、禁用或已删除的 Webhook。
GET
/
v2
/
webhooks
获取 Webhook 列表
curl --request GET \
--url https://api-test.velafi.com/v2/webhooks \
--header 'X-BH-TOKEN: <api-key>'import requests
url = "https://api-test.velafi.com/v2/webhooks"
headers = {"X-BH-TOKEN": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-BH-TOKEN': '<api-key>'}};
fetch('https://api-test.velafi.com/v2/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api-test.velafi.com/v2/webhooks")
.header("X-BH-TOKEN", "<api-key>")
.asString();{
"code": 123,
"msg": "<string>",
"data": [
{
"webhookId": "<string>",
"eventType": "<string>",
"url": "<string>",
"status": 123,
"publicKey": "<string>"
}
]
}使用此接口列出你账户上注册的 Webhook 端点。你可以按状态筛选,仅查看启用、禁用或已删除的 Webhook。响应最多包含 100 个 Webhook,按最近更新时间倒序排列。每条结果都包含
webhookId、事件类型、回调 URL 以及用于签名验证的公钥。
所有请求都必须包含
X-BH-TOKEN 请求头,其值为通过 GET /v2/token/generate 获取的业务令牌。接口地址
GET https://api.velafi.com/v2/webhooks
查询参数
integer
可选。按 Webhook 状态筛选。如果省略,将返回所有状态的 Webhook,包括已删除的:
10— 启用20— 禁用30— 已删除
响应字段
number
HTTP 风格的响应码。
200 表示成功。string
可读的状态信息,例如
SUCCESS。array
示例
cURL
curl -G https://api.velafi.com/v2/webhooks \
-H "X-BH-TOKEN: YOUR_TOKEN" \
--data-urlencode "status=10"
Response
{
"code": 200,
"msg": "SUCCESS",
"data": [
{
"webhookId": "ebab8a9663704e7cbbebe672c7c67912",
"eventType": "ORDER_WEBHOOK",
"url": "https://your-app.com/webhooks/velafi",
"status": 10,
"publicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp/6GRTIrl+kQb9u27cGz..."
}
]
}
如果需要轮换或替换 Webhook URL,请在此处获取
webhookId,然后使用新 URL 调用更新 Webhook 接口。⌘I
获取 Webhook 列表
curl --request GET \
--url https://api-test.velafi.com/v2/webhooks \
--header 'X-BH-TOKEN: <api-key>'import requests
url = "https://api-test.velafi.com/v2/webhooks"
headers = {"X-BH-TOKEN": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-BH-TOKEN': '<api-key>'}};
fetch('https://api-test.velafi.com/v2/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api-test.velafi.com/v2/webhooks")
.header("X-BH-TOKEN", "<api-key>")
.asString();{
"code": 123,
"msg": "<string>",
"data": [
{
"webhookId": "<string>",
"eventType": "<string>",
"url": "<string>",
"status": 123,
"publicKey": "<string>"
}
]
}
