WebHook 推送
Qbit 通过 WebHook 来通知,客户端以指定格式提供的单个回调 URL。Qbit 将根据下面进一步描述的场景发送不同的有效负载,触发事件可以根据 payload body 中的 Template(模板) 字段来理解。
客户端提供的预期 URL 格式如下:
POST https://<host:port>/qbit/webhook
1
客户应该返回指定的返回码,如果发送回调的 URL 后没有收到相应的返回码,Qbit 系统将认为推送不成功。返回字段如下:
字段 | 类型 | 说明 |
---|---|---|
id | string | 推送给客户的通知id |
received | boolean | 接收标识 |
{
"id": "32b0216b-66d9-498b-a4bc-17612d9cb6cd",
"received": true
}
1
2
3
4
2
3
4
Qbit 系统将会延迟推送,依次推送的时间为:30s,60s,120s、240s 等依次延后推送,最多推送 5 次。
推送字段:Notification
获取通知列表
GET
/open-api/v1/notifications
Headers:
Header | Parameters | 说明 |
---|---|---|
x-qbit-access-token | string | access token |
Content-Type | application/json | json 类型 |
GET 请求参数:
字段 | 类型 | 是否为必填 | 说明 |
---|---|---|---|
id | string | 否 | id |
limit | number | 否 | 默认 10 条 |
page | number | 否 | 默认 0 |
accountId | string | 是 | 客户 Id |
返回参数:
字段 | 类型 | 说明 |
---|---|---|
data | Notification[] | Notification的数组 |
total | number | 总数量 |
请求示例:
curl -X GET "https://global.service.staging.qbitnetwork.com/open-api/v1/notifications?limit=10&page=0&id=4322fd4f-8458-42ea-9414-8362e1dc636a&accountId=c110e2aa-322b-4f3f-a795-f441955844ed" \
-H 'content-type: application/json' \
-H 'x-qbit-access-token: db19fa75f4ed674135e26965173ff66f722684bb'
1
2
3
2
3
返回示例:
{
"data": [
{
"id": "4322fd4f-8458-42ea-9414-8362e1dc636a",
"accountId": "e2ce94f7-3f8d-4a70-aa8f-4d0717fe7a2d",
"createTime": "2021-05-11T07:57:45.236Z",
"businessType": "CreateGlobalAccount",
"businessStatus": "Passed",
"remark": "KYC审核通过",
"data": "",
"status": "readed"
}
],
"total": 1
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15