保利威文档中心

帮助中心

查询分类列表

更新时间:2022-09-02 18:08:07

接口描述

1、通过分类id分页查询分类列表
2、接口支持https协议

接口URL

http://api.polyv.net/v3/category/get

在线API调用

请求方式

POST

接口约束

1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看

请求参数描述

参数名 必选 类型 说明
appId true String 保利威点播子账户appId,获取路径:保利威点播后台->设置->账号管理
timestamp true Long 当前时间的毫秒级时间戳,3分钟内有效
sign true String 签名,为32位大写的MD5值【详见MD5签名生成规则
cateId true Long 分类id,默认为1则查询所有分类列表
page false Integer 子分类列表页码
pageSize false Integer 子分类每页大小

示例

http://api.polyv.net/v3/category/get

表单参数:

cateId=1608891483165&appId=a0Wmol5EwX&sign=2A0027CB75FEF9F24DD6B680A2FC20AE&timestamp=1617935598256

响应参数描述

参数名 类型 说明
requestId String 每次请求的业务流水号,必须唯一,便于客户端/服务器端排查问题
code Integer 响应状态码,200为成功返回,非200为失败【详见全局错误说明
status String 响应状态文本信息
error Object 响应成功返回null,响应失败返回错误描述信息【详见error参数描述
data Object 响应成功时返回分类列表信息【详见data字段说明
error参数描述
参数名 类型 说明
code Integer 错误码
desc String 错误描述
data参数描述
参数名 类型 说明
category Object 当前分类信息【详见category字段说明
subCategoryTotal Integer 下一级子分类个数
subCategories Array 下一级子分类列表【详见subCategories字段说明
category参数描述
参数名 类型 说明
cateId Long 分类id
cateName String 分类名称
parentId Long 上一级分类id
subCategories参数描述
参数名 类型 说明
cateId Long 分类id
cateName String 分类名称
parentId Long 上一级分类id

Java请求示例

快速接入基础代码请下载相关依赖源码点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 VodSignUtil.java 都包含在下载文件中。

强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。

private static final Logger log = LoggerFactory.getLogger(VodSubAccountTest.class);
/**
 * 查询分类列表
 * @throws Exception
 * @throws NoSuchAlgorithmException
 */
@Test
public void testSubGetCategories() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/v3/category/get";
    String cateId = "1608891483165";

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("cateId", cateId);
    requestMap.put("sign", VodSignUtil.getSignMd5(requestMap, appSecret));

    String response = HttpUtil.postFormBody(url, requestMap);
    log.debug("测试查询分类列表,{}", response);
    //do somethings

}

响应示例

系统全局错误说明详见全局错误说明

成功示例

{
    "requestId":"52ec91c6-4b2e-487e-976c-03378d3035af",
    "code":200,
    "status":"success",
    "error":null,
    "data":{
        "category":{
            "cateId":1608891483165,
            "cateName":"伪直播功能专用分类",
            "parentId":1
        },
        "subCategoryTotal":7,
        "subCategories":[
            {
                "cateId":1608891483169,
                "cateName":"2070151",
                "parentId":1608891483165
            },
            {
                "cateId":1610069551999,
                "cateName":"2087172",
                "parentId":1608891483165
            },
            {
                "cateId":1610605203885,
                "cateName":"2095792",
                "parentId":1608891483165
            },
            {
                "cateId":1615344036891,
                "cateName":"2149710",
                "parentId":1608891483165
            },
            {
                "cateId":1615357280260,
                "cateName":"2149813",
                "parentId":1608891483165
            },
            {
                "cateId":1616053580583,
                "cateName":"2205908",
                "parentId":1608891483165
            },
            {
                "cateId":1616572747765,
                "cateName":"1958888",
                "parentId":1608891483165
            }
        ]
    }
}

异常示例

时间戳错误

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 100,
        "desc": "invalid timestamp"
    },
    "data": null
}

appId不正确

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 101,
        "desc": "application not exist"
    },
    "data": null
}

子账号不存在

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 102,
        "desc": "user children not exist"
    },
    "data": null
}

子账号过期

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 103,
        "desc": "user children expired"
    },
    "data": null
}

签名错误

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 104,
        "desc": "invalid signature"
    },
    "data": null
}

账号权限不足

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 403,
    "status": "error",
    "error": {
        "code": 105,
        "desc": "permission limited"
    },
    "data": null
}

分类不存在

{
    "requestId": "5ede3d23-45f0-4661-99be-e95d07daf049",
    "code": 400,
    "status": "error",
    "error": {
        "code": 3001,
        "desc": "category not exist"
    },
    "data": null
}
联系客服,在线咨询