1、查询分类目录
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
4、每个账户预设根目录,名字为默认分类
http://api.polyv.net/v2/video/{userid}/cataJson
http://api.polyv.net/v2/video/1b448be323/cataJson?sign=4CAE0A6A4C897B67EE7E9405806923B315F4C8A8&cataid=1617160372987&userid=1b448be323&ptime=1617172296970
强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(VodVideoCategoryTest.class);
/**
* 获取分类及子分类
*/
@Test
public void testGetVideoCategory() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/v2/video/" + userId + "/cataJson";
String cataId = "1617160372987";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userId);
requestMap.put("ptime", ptime);
//系统只部分参数进行签名
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
requestMap.put("cataid", cataId);
String response = HttpUtil.get(url, requestMap);
log.debug("测试获取分类及子分类,{}", response);
//do somethings
}
{
"code": 200,
"status": "success",
"message": "success",
"data": [
{
"text": "分类名称1 (0) ",
"cataname": "分类名称1",
"catatree": "1,1617160372987",
"cataid": 1617160372987,
"parentid": 1,
"cataProfile": "",
"videos": 0,
"nodes": [
{
"text": "分类名称1111 (0) ",
"cataname": "分类名称1111",
"catatree": "1,1617160372987,1617173351969",
"cataid": 1617173351969,
"parentid": 1617160372987,
"cataProfile": "",
"videos": 0
},
{
"text": "分类名称2222 (0) ",
"cataname": "分类名称2222",
"catatree": "1,1617160372987,1617173363572",
"cataid": 1617173363572,
"parentid": 1617160372987,
"cataProfile": "",
"videos": 0
}
]
}
]
}
{
"code": 400,
"status": "error",
"message": "the sign is not right.",
"data": ""
}