Query All Role Information Under a Channel ID
Updated: 2024-07-22 14:14:15
API Description
1、查询频道内所有助教和嘉宾的具体信息
2、接口URL中的{channelId}为频道号
3、接口支持https协议
API URL
http://api.polyv.net/live/v2/channelAccount/{channelId}/accounts
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls are subject to rate limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details on obtaining keys |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See signature generation rules |
Example
https://api.polyv.net/live/v2/channelAccount/2191541/accounts?appId=frlr1zazn3&sign=BE8A0E88376E1B4BB1BBB48BADD5AFBE×tamp=1621841937679
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure See global error description |
| status | String | Response status text information |
| message | String | Response description message, auxiliary error description when code is 400 or 500 |
| data | Array | Empty on request failure; role information on success See data field description |
Data Field Description
| Parameter | Type | Description |
|---|---|---|
| account | String | Assistant/Guest account |
| userId | String | POLYV user ID, consistent with the Polyv official website. Retrieval path: Official website -> Login -> Live (Development Settings) |
| channelId | String | Channel ID |
| passwd | String | Role password |
| nickname | String | Role name |
| stream | String | Role stream name, invalid when used alone |
| status | String | Role status |
| createdTime | Long | Role creation time |
| lastModified | Long | Role last modification time |
| sort | String | Role sequence number in the channel |
| avatar | String | Role avatar |
| actor | String | Role title |
| pageTurnEnabled | String | Whether the role has page turning permission. Only one role can have this. Only supported in three-screen scenarios. Y: Yes N: No |
| notifyEnabled | String | Whether the role has permission to publish announcements. Y: Yes N: No |
| checkinEnabled | String | Whether the role has permission to start check-in. Y: Yes N: No |
| voteEnabled | String | Whether the role has permission to initiate voting. Y: Yes N: No |
| lotteryEnabled | String | Whether the role has permission to conduct lotteries. Y: Yes N: No |
| role | String | Role Assistant: Assistant Guest: Guest |
| chatListEnabled | String | Online list display toggle on the assistant page. Y: Enabled N: Disabled |
| chatAuditEnabled | String | Assistant chat audit. Y: Enabled N: Disabled |
| monitorEnabled | String | Assistant monitoring toggle. Y: Enabled N: Disabled |
| roundTourEnabled | String | Assistant round-robin toggle. Y: Enabled N: Disabled |
| watchLockEnabled | String | Lock live room function toggle. Y: Enabled N: Disabled |
| chatInteractionEnabled | String | Interactive chat function toggle. Y: Enabled N: Disabled |
| pushUrl | String | Role push stream URL. For role push streaming, please refer to the backend director console usage. |
Java Request Example
For quick integration of the basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases HttpUtil.java and LiveSignUtil.java are included in the downloaded file.
It is strongly recommended to use the Live Java SDK for API functionality integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
*查询频道号下所有角色信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetAccounts() 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/v2/channelAccount/%s/accounts";
String channelId="2149710";
url = String.format(url, channelId);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道号下所有角色信息,返回值:{}", response);
//do somethings
}
Response Example
For system-wide global error descriptions, see Global Error Description
Success Example
{
"code":200,
"status":"success",
"message":"",
"data":[
{
"account":"0072149710",
"userId":"1b448be323",
"channelId":2149710,
"passwd":"xxxxxx",
"nickname":"赵老师",
"stream":"km1fvuo3",
"status":"Y",
"createdTime":1615259640000,
"lastModified":1615259640000,
"channelSessionId":null,
"sort":7,
"avatar":"//s1.videocc.net/default-img/avatar/assistant.png",
"actor":"助教",
"pageTurnEnabled":"N",
"notifyEnabled":"Y",
"checkinEnabled":"Y",
"voteEnabled":"Y",
"lotteryEnabled":"Y",
"role":"Assistant",
"chatListEnabled":"Y",
"chatAuditEnabled":"N",
"monitorEnabled":"N",
"roundTourEnabled":"N",
"watchLockEnabled":"N",
"pushUrl":"rtmp://push-d1.videocc.net/recordf/1b448be32316137918188520c60km1fvuo3?auth_key=1615341964-0-0-fc732106ae504b75082042014f616f34"
}
]
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
