批量创建子频道

接口URL

http://api.polyv.net/live/v3/channel/account/batch-create

接口说明

(接口调用有频率限制,详细请查看)

1、批量创建子频道,子频道角色支持guest(嘉宾,只支持三分屏场景)、assistant(助教)
2、接口支持https

返回结果支持格式

JSON

请求方式

POST

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 当前13位毫秒级时间戳,3分钟内有效
sign string 签名,为32位大写的MD5值
channelId int 频道号

请求体参数

参数名 必选 类型 说明
role string 默认不传为助教,传Guest为嘉宾
nickname string 创建的助教或嘉宾昵称
passwd string 子频道密码
actor string 创建的助教或嘉宾头衔
avatar string 创建的助教或嘉宾头像

请求体信息示例

[
    {
        "role":"guest",
        "nickname": "嘉宾",
        "passwd": 123456
    },
    {
        "role":"assistant",
        "nickname": "助教",
        "passwd": 123456
    }
]

响应成功JSON示例:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": [
        {
            "account": "00111765203",
            "userId": "ee7fe7fbda",
            "channelId": 1765203,
            "passwd": "1",
            "nickname": "测试嘉1宾",
            "stream": "kcwz3qy4",
            "status": "Y",
            "createdTime": 1595398549000,
            "lastModified": 1595398549000,
            "channelSessionId": null,
            "sort": 11,
            "avatar": "//s1.videocc.net/default-img/avatar/guest.png",
            "actor": "嘉宾",
            "pageTurnEnabled": "N",
            "notifyEnabled": "N",
            "checkinEnabled": "Y",
            "voteEnabled": "N",
            "lotteryEnabled": "N",
            "role": "guest",
            "chatListEnabled": "Y",
            "chatAuditEnabled": "N",
            "monitorEnabled": "N",
            "roundTourEnabled": "N",
            "watchLockEnabled": "N",
            "loginUrl": "https://live.polyv.net/web-start/login?channelId=00111765203"
        }
    ]
}

响应失败JSON示例:

未输入appId

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

appId不正确

{
    "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": 400, 
  "status": "error", 
  "message": "param is not digit: dsadasd", 
  "data": ""
}

子频道角色错误

{
    "code": 400,
    "status": "error",
    "message": "invalid account role type",
    "data": ""
}

格式化json错误

{
    "code": 500,
    "status": "fail",
    "message": "undefined error",
    "data": null
}
{
    "code": 400,
    "status": "error",
    "message": "json format error",
    "data": ""
}

字段说明

参数名 类型 说明
code int 响应代码,成功为200,失败为400,签名错误为401,异常错误500
status string 成功为success,失败为error
message string 错误时为错误提示消息
account int 助教ID
userId string 用户ID
channelId int 频道ID
passwd string 助教密码
nickname string 助教名称
stream string 助教流名(单独使用无效)
status string 助教状态
createdTime long 创建助教时间
lastModified long 助教最后修改时间
sort int 频道中所有助教序号
avatar string 助教头像
pageTurnEnabled string 助教翻页权限(只能一个助教有)
notifyEnabled string 发布公告权限
checkinEnabled string 开启签到权限
voteEnabled string 发起投票
role string 子频道角色
loginUrl string 子账号(嘉宾)登陆地址
lotteryEnabled string 是否拥有抽奖权限(Y/N)
chatListEnabled string 助教页在线列表显示开关(Y/N)
chatAuditEnabled string 助教聊天审核权限(Y/N)
monitorEnabled string 监播权限开关(Y/N)
roundTourEnabled string 助教轮巡权限开关(Y/N)
watchLockEnabled string 锁定直播间权限 (Y/N)
channelSessionId string 场次号

Java请求示例

public static void main(String[] args) {
        String url = "http://api.polyv.net/live/v3/channel/account/batch-create";
        // 用户对应的appId和加密串
        String appId = "xxxxxx";
        String appSecret = "xxxxxxxxxxxxxxxxxxxxxxx";
        // 查询频道号
        String channelId = "1796673";
        Map<String, String> params = new HashMap<>();
        params.put("channelId", channelId);
        String reqBody = "[{\"role\":\"guest\",\"nickname\": \"测试嘉1宾\",\"passwd\": 1}]";
        // 调用Polyv的工具类方法设置sign
        PolyvTool.setLiveSign(params, appId, appSecret);
        // 调用Polyv的httpClient工具类发送请求
        String content = HttpClientUtil.getInstance()
                .sendHttpPostJson(url + "?" + PolyvTool.mapJoinNotEncode(params), reqBody, null);
        System.out.println(content);
    }

签名规则(PolyvTool.java文件代码查看)

https://dev.polyv.net/2020/liveproduct/l-api/rule/live-api-java-detail/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...