http://api.polyv.net/live/v3/channel/watch/get-api-token
1、获取观众观看调用接口token
2、接口支持https
{
"code": 200,
"status": "success",
"message": "",
"data": {
"token": "fri7txjyy1"
}
}
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
{
"code": 403,
"status": "error",
"message": "illegal channel id: 1779742",
"data": ""
}
public static void main(String[] args) {
String url = "http://api.polyv.net/live/v3/channel/watch/get-api-token";
// 用户对应的appId和加密串
String appId = "xxxxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
Map<String, String> params = new HashMap<>();
params.put("channelId", "0000000");
params.put("viewerId", "1234567890");
PolyvTool.setLiveSign(params, appId, appSecret);
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance()
.sendHttpPost(url, params, null);
System.out.println(content);
}