# 查看账号主授权关系列表
接口应在服务器端调用,不可在前端(小程序、网页、APP等)直接调用,具体可参考接口调用指南。
接口英文名:querybookauthv2
此接口可用于查看账号的授权关系列表,也可以看账号被授权关系列表。
- 查看账号的授权关系列表,主授权账号使用(同 appid 每天限额调用 50000 次)
- 查看账号的被授权关系列表,被授权账号使用(同 appid 每天限额调用 10000 次),支持查询:当前账号关联的授权方账号列表、指定授权方所授权的小说列表、指定小说的账号级别授权信息
- 查询指定授权方所授权的小说列表
- 查询指定小说的授权信息
# 1. 调用方式
# HTTPS 调用
POST https://api.weixin.qq.com/wxa/book/querybookauthv2?access_token=ACCESS_TOKEN
# 云调用
- 本接口不支持云调用。
# 第三方调用
本接口支持第三方平台代商家调用。
该接口所属的权限集 id 为:169
服务商获得其中之一权限集授权后,可通过使用 authorizer_access_token 代商家进行调用,具体可查看 第三方调用 说明文档。
# 2. 请求参数
# 查询参数 Query String Parameters
| 参数名 | 类型 | 必填 | 示例 | 说明 |
|---|---|---|---|---|
| access_token | string | 是 | ACCESS_TOKEN | 接口调用凭证,可使用 access_token、authorizer_access_token |
# 请求体 Request Payload
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | number | 否 | 填 0 或者不设置: 查授权列表, 填 1: 查被授权列表 |
| count | number | 是 | 获取记录的数量, 上限一次 100 条,用于分页 |
| cursor | string | 否 | 分页游标。不填或填空字符串,标识从第一页开始查询。后一页查询填充上一页响应的next_cursor字段值 |
| grantor_appid | string | 否 | 用于查询指定授权方授权给当前账户的小说列表,当查询指定授权方所授权的小说列表时需要传 |
| book_ids | array | 否 | 用于查询指定小说的授权信息,上限一次 30 条。查询指定小说的授权信息场景下需要传递此参数。优先级高于 grantor_appid,当 book_ids 不为空时,grantor_appid 参数无效。 |
# 3. 返回参数
# 返回体 Response Payload
| 参数名 | 类型 | 说明 |
|---|---|---|
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
| appid_results | objarray | 被授权方列表, 结果按授权过期时间从早到晚排序 |
| next_cursor | string | 下一页游标 |
# Res.appid_results(Array) Object Payload
被授权方列表, 结果按授权过期时间从早到晚排序
| 参数名 | 类型 | 说明 |
|---|---|---|
| grantor_appid | string | 主授权账号appid |
| grantee_appid | string | 被授权账号appid |
| expire_time | number | 授权到期时间,unix时间戳,单位秒,按CST时区 |
| book_id | string | 作品id,查询指定授权方授权给当前账户的小说列表时会返回 |
# 4. 注意事项
本接口无特殊注意事项
# 5. 代码示例
# 5.1 查询授权关系列表
请求示例
{
"type": 0,
"count": 20,
"cursor": ""
}
返回示例
{
"errcode": 0, //当等于0时,results字段的数据才有效
"errmsg": "ok",
"appid_results": [
{
"grantor_appid": "wx001",
"grantee_appid": "wx004",
"expire_time": 1704259146
},
{
"grantor_appid": "wx001",
"grantee_appid": "wx005",
"expire_time": 1801698644
}
],
"next_cursor": "123456"
}
# 5.2 查询被授权关系
请求示例
type = 1,不传 grantor_appid 和 book_ids
{
"type": 1,
"cursor": "",
"count": 5
}
返回示例
{
"errcode": 0,
"errmsg": "ok",
"appid_results": [
{
"grantor_appid": "wx003",
"grantee_appid": "wx002",
"expire_time": 1704970161
},
{
"grantor_appid": "wx001",
"grantee_appid": "wx002",
"expire_time": 1705460123
}
],
"next_cursor": "123456"
}
# 5.3 查询指定授权方所授权的小说列表
请求示例
type = 1,传 grantor_appid
{
"type": 1,
"cursor": "",
"count": 5,
"grantor_appid": "wx001"
}
返回示例
{
"errcode": 0,
"errmsg": "ok",
"book_results": [
{
"book_id": "b001",
"grantor_appid": "wx001",
"grantee_appid": "wx002",
"expire_time": 1704970161
},
{
"book_id": "b002",
"grantor_appid": "wx001",
"grantee_appid": "wx002",
"expire_time": 1704970161
}
],
"next_cursor": "123456"
}
# 5.4 查询指定小说的授权信息
请求示例
type = 1,book_ids 元素不为空
{
"type": 1,
"book_ids": ["b001", "b003"]
}
返回示例
{
"errcode": 0,
"errmsg": "ok",
"book_results": [
{
"book_id": "b001",
"grantor_appid": "wx001",
"grantee_appid": "wx002",
"expire_time": 1704970161
},
{
"book_id": "b003",
"grantor_appid": "wx003",
"grantee_appid": "wx002",
"expire_time": 1705460123
}
]
}
# 6. 错误码
此接口没有特殊错误码,可参考 通用错误码;调用接口遇到报错,可使用官方提供的 API 诊断工具 辅助定位和分析问题。
# 7. 适用范围
本接口暂未明确可调用账号类型,或在业务中根据调用传参自行确定是否可调用,请以实际调用情况为准。