接口描述
1、修改研讨会的登录条件
2、主要参会条件不能关闭,否则返回参数错误
3、相同参会条件(主要参会条件/次要参会条件),不同角色的开关、认证类型必须相同,否则返回参数错误
4、相同参会条件(主要参会条件/次要参会条件),不同角色的密码/独立授权key必须不同,否则返回参数错误
4、当认证类型是密码登录时,密码不能为空;当认证类型是独立授权时,授权key不能为空,否则返回参数错误
5、主要参会条件和次要参会条件的类型为相同时,不能够同时打开,否则返回参数错误
6、(channelId, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
7、接口支持https协议
接口URL
https://api.polyv.net/live/v3/channel/seminar/setting/auth/set
请求方式
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
参数名 | 必选 | 类型 | 说明 |
---|
| | | |
| | | |
| | | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据 【详见签名生成规则】 |
| | | |
请求体参数描述
authSettings字段说明
参数名 | 必选 | 类型 | 说明 |
---|
| | | |
| | | |
| | | |
| | | 参会条件类型
password:密码登录
direct:独立授权
custom:自定义授权
phone:白名单观看 |
| | | 当authType为password时,密码登录的password |
| | | 当authType为direct时,设置参数,非必填,独立授权SecretKey |
| | | 当authType为custom时,为自定义授权自定义URL |
| | | 当authType为custom时,为自定义授权SecretKey |
| | | |
示例
https://api.polyv.net/live/v3/channel/seminar/setting/auth/set?appId=frlr1zazn3&sign=E2B692768C6F467B1228B5876625B71E&channelId=2191532×tamp=1621843761626
请求体参数
{
"authSettings": [{
"rank": 1,
"enabled": "Y",
"authType": "password",
"roleCode": "host",
"password": "464nk4"
}, {
"rank": 1,
"enabled": "Y",
"authType": "password",
"roleCode": "attendee",
"password": "w8u81f"
}, {
"rank": 2,
"enabled": "Y",
"authType": "direct",
"roleCode": "host",
"directKey": "b3z0fy1y3z"
}, {
"rank": 2,
"enabled": "Y",
"authType": "direct",
"roleCode": "attendee",
"directKey": "lv2n30e15i"
}]
}
响应参数描述
参数名 | 类型 | 说明 |
---|
| | 响应状态码,200为成功返回,非200为失败【详见全局错误说明】 |
| | |
| | 响应描述信息,当code为400或者500的时候,辅助描述错误原因 |
| | |
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
强烈建议您使用直播Java SDK完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(SeminarAuthTest.class);
/**
* 修改频道观看条件
* @throws IOException
*/
@Test
public void testSetSeminarAuth() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/live/v3/channel/seminar/setting/auth/set";
String channelId = "2191532";
String body = "{\n" +
"\t\"authSettings\": [{\n" +
" \"rank\": 1,\n" +
" \"enabled\": \"Y\",\n" +
" \"authType\": \"password\",\n" +
" \"roleCode\": \"host\",\n" +
" \"password\": \"464nk4\"\n" +
" }, {\n" +
" \"rank\": 1,\n" +
" \"enabled\": \"Y\",\n" +
" \"authType\": \"password\",\n" +
" \"roleCode\": \"attendee\",\n" +
" \"password\": \"w8u81f\"\n" +
" }, {\n" +
" \"rank\": 2,\n" +
" \"enabled\": \"Y\",\n" +
" \"authType\": \"direct\",\n" +
" \"roleCode\": \"host\",\n" +
" \"directKey\": \"b3z0fy1y3z\"\n" +
" }, {\n" +
" \"rank\": 2,\n" +
" \"enabled\": \"Y\",\n" +
" \"authType\": \"direct\",\n" +
" \"roleCode\": \"attendee\",\n" +
" \"directKey\": \"lv2n30e15i\"\n" +
" }]\n" +
"}";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, body, null);
log.info("测试修改频道观看条件接口返回值:{}",response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code": 200,
"status": "success",
"message": "",
"data": true
}
异常示例
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
{
"code": 10620,
"status": "error",
"message": "role rank empty",
"data": ""
}
{
"code": 10621,
"status": "error",
"message": "enabled cannot be different",
"data": ""
}
{
"code": 10622,
"status": "error",
"message": "auth cannot be different",
"data": ""
}
{
"code": 10623,
"status": "error",
"message": "password cannot be empty",
"data": ""
}
{
"code": 10624,
"status": "error",
"message": "secret key cannot be empty",
"data": ""
}
{
"code": 10625,
"status": "error",
"message": "duplicated seminar role secret key",
"data": ""
}
{
"code": 10601,
"status": "error",
"message": "duplicated seminar role password",
"data": ""
}
{
"code": 10626,
"status": "error",
"message": "unknown role",
"data": ""
}
{
"code": 10627,
"status": "error",
"message": "lack host or attendee",
"data": ""
}
{
"code": 10628,
"status": "error",
"message": "main auth cannot be disabled",
"data": ""
}
{
"code": 10629,
"status": "error",
"message": "duplicated auth",
"data": ""
}