<font size=5 color=Red>请注意:本页面接口为第三方实现接口后B站来调用。 第三方实现接口需要按照统一签名规范进行实现。 文档参考:接口签名实现标准</font>
实现接口前请先查看接入指引
获取资源列表#
接口说明:通过该接口获取接入方返回的资源列表信息 demo_path(仅供参考): https://{your_service_domain}/resource_list 请求方式:POST
Body 请求参数
json
{
"page": 16,
"page_size": 5,
"biz_source": "bili",
"request_id": "313b0f9976c4008e2c8a02737265795f",
"biz_code":"bilibili_fgo",
"open_id":"60b8cf87b2614ec7980f7935b8b00159"
"start_time":1709712714,
"end_time":1709712715,
}B站发起请求参数#
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| biz_source | body | string | 是 | 资源source | 用于标识业务方,当同一用户在第三方有多个业务接入时用于区分来源 |
| request_id | body | string | 是 | 请求id | b站请求id,用于链路跟踪,建议日志记录该字段,方便后期追溯问题 |
| page | body | integer | 是 | 页码 | 页码 |
| page_size | body | integer | 是 | 每页数据量 | 每页数据 |
| biz_code | body | string | 是 | 三方业务码 | 三方业务码,用于区分同一个业务方的不同应用 |
| open_id | body | string | 否 | open_id | 用户在该应用下的唯一ID |
| start_time | body | int64 | 否 | 起始时间 | 请求资源时间范围开始时间的时间戳 |
| end_time | body | int64 | 否 | 结束时间 | 请求资源时间范围结束时间的时间戳 |
接入方返回结果#
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功 | Inline |
返回数据结构#
状态码 200
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » code | integer | true | none | 错误码 | 0正常返回,其他错误码详见错误码枚举 |
| » message | string | false | none | 描述 | 发生错误可通过该字段返回错误描述 |
| » request_id | string | true | none | 请求id | 三方的调用请求id |
| » page | object | true | none | none | |
| »» page | integer | true | none | 页码 | 页码 |
| »» page_size | integer | true | none | 每页数据量 | 每页数据量 |
| »» total | integer | true | none | 资源总数量 | 资源总数量 |
| » data | object | true | none | none | |
| »» list | [object] | true | none | none | |
| »»» title | string | true | none | 资源名称 | none |
| »»» download_link | string | true | none | 资源下载地址 | none |
| »»» download_expire_at | integer | true | none | 资源下载地址有效期 | 时间戳(秒级) utc;0表示永不过期 |
| »»» id | string | true | none | 资源唯一id | none |
| »»» version | string | true | none | 资源版本 | none |
| »»» create_at | integer | false | none | 资源创建时间 | 时间戳(秒级) utc; |
| »»» last_modify_at | integer | false | none | 资源最近修改时间 | 时间戳(秒级) utc |
| »»» owner_name | string | false | none | 资源拥有者 | none |
| »»» owner_head_img | string | false | none | 资源拥有者头像 | none |
| »»» source_md5 | string | false | none | 资源md5 | none |
| »»» extra | string | false | none | 额外参数 | json格式 |
| »»» size | integer | true | none | 资源大小 | none |
| »» extra | string | true | none | 额外数据 | json格式 |
返回示例
成功
json
{
"code": 0,
"request_id": "313b0f9976c4008e2c8a02737265795f",
"message": "success",
"page": {
"page": 7,
"page_size": 1,
"total": 1000
},
"data": {
"list": [
{
"title": "nico.mp4",
"download_link": "http://www.bilibili.com/download",
"download_expire_at": 1701231222,
"id": "67",
"version": "v1",
"size": 1024,
"last_modify_at": 1701231222,
"source_md5": "asdjlfksdkal-aslkbbklakdf",
"owner_head_img": "http://dummyimage.com/400x400",
"owner_name": "nico",
"extra": "{\"a\": 1}",
"create_at": 1010774109731
}
],
"extra": "{\"a\": 1}"
}
}失败
json
{
"page": {},
"data": {
"list": [],
"extra": ""
},
"code": -1100,
"request_id": "313b0f9976c4008e2c8a02737265795f",
"message": "内部异常"
}查询单个资源详情#
接口说明:通过该接口向接入方查询单个资源的详细信息 demo_path(仅供参考): https://{your_service_domain}/resource_detail 请求方式:POST
Body 请求参数
json
{
"id": "3",
"biz_source": "bili_r",
"request_id": "2313b0f9976c4008e2c8a02737265795f",
"biz_code": "bilibili_fgo"
}B站发起请求参数#
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| biz_source | body | string | 是 | 资源source | 用于标识业务方,当同一用户在第三方有多个业务接入时用于区分来源 |
| request_id | body | string | 是 | 请求id | b站请求id,用于链路跟踪,建议日志记录该字段,方便后期追溯问题 |
| id | body | string | 是 | 资源id | 资源id |
| biz_code | body | string | 是 | 三方业务码 | 三方业务码,用于区分同一个业务方的不同应用 |
接入方返回结果#
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | 成功 | Inline |
返回数据结构#
状态码 200
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| code | integer | true | none | 错误码 | 0正常返回,其他错误码详见错误码枚举 |
| message | string | false | none | 描述 | 发生错误可通过该字段返回错误描述 |
| request_id | string | true | none | 请求id | 三方的调用请求id |
| data | object | true | none | none | |
| » title | string | true | none | 资源名称 | none |
| » download_link | string | true | none | 资源下载地址 | none |
| » download_expire_at | integer | true | none | 资源下载地址有效期 | 时间戳(秒级) utc;0表示永不过期 |
| » id | string | true | none | 资源唯一id | none |
| » version | string | true | none | 资源版本 | none |
| » create_at | integer | false | none | 资源创建时间 | 时间戳(秒级) utc; |
| » last_modify_at | integer | false | none | 资源最近修改时间 | 时间戳(秒级) utc |
| » owner_name | string | false | none | 资源拥有者 | none |
| » owner_head_img | string | false | none | 资源拥有者头像 | none |
| » source_md5 | string | false | none | 资源md5 | none |
| » extra | string | false | none | 额外参数 | json格式 |
| » size | integer | true | none | 资源大小 | none |
返回示例
成功
json
{
"data": {
"title": "nico.mp4",
"download_link": "http://wwww.bilibili.com/download",
"download_expire_at": 1701231222,
"id": "67",
"version": "v1",
"size": 1024,
"last_modify_at": 1701231222,
"source_md5": "asdjlfksdkal-aslkbbklakdf",
"owner_head_img": "http://dummyimage.com/400x400",
"owner_name": "nico",
"extra": "{\"a\": 1}",
"create_at": 1010774109731
},
"code": 0,
"request_id": "313b0f9976c4008e2c8a02737265795f",
"message": "success"
}失败
json
{
"data": {},
"code": -1100,
"request_id": "313b0f9976c4008e2c8a02737265795f",
"message": "内部错误"
}与接入方错误码约定#
| 错误码 | 含义 | B站侧处理逻辑 |
|---|---|---|
| 0 | 成功 | |
| -1000 | 资源不存在 | 返回给上游业务 |
| -1100 | 内部错误 | 返回给上游业务 |
| -1200 | 其他错误(请在message中简要描述错误) | 返回给上游业务 |
| -1300 | 并发限制 | 返回给上游业务 |
| -1400 | 用户无权限 | 返回给上游业务 |