Polyv Help Center

Help Center

Query Single Role Information

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}/account

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have frequency 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 within 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
account true String Assistant/Guest account (Must not be submitted as a numeric type, otherwise the leading '00' before the role number may be removed)

Example

https://api.polyv.net/live/v2/channelAccount/2191541/account?appId=frlr1zazn3&sign=2D733253D9E982E7AEE33C083A388AC1&account=0052191541&timestamp=1621841869093

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
message String Response description, provides error details when code is 400 or 500
data Object Empty on failure, contains 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 Integer Channel role sequence number
avatar String Role avatar
pageTurnEnabled String Whether page turning permission is enabled, only one role can have it, supported only in tri-screen scenario
Y: Yes
N: No
notifyEnabled String Whether announcement publishing permission is enabled
Y: Yes
N: No
checkinEnabled String Whether check-in permission is enabled
Y: Yes
N: No
voteEnabled String Whether voting permission is enabled
Y: Yes
N: No
lotteryEnabled String Whether lottery permission is enabled
Y: Yes
N: No
role String Role
Assistant: Assistant
Guest: Guest
chatListEnabled String Online list display toggle on 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 Live room lock 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 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 include HttpUtil.java and LiveSignUtil.java 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 testGetAccount() 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/account";
    String channelId="2149710";
    String account = "0062149710";
    
    url = String.format(url, channelId);
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("account", account);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询角色信息,返回值:{}", response);
    //do somethings
    
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code":200,
    "status":"success",
    "message":"",
    "data":{
        "account":"0062149710",
        "userId":"1b448be323",
        "channelId":2149710,
        "passwd":"xxxxxx",
        "nickname":"杨老师123",
        "stream":"km1bdhf9",
        "status":"Y",
        "createdTime":1615252064000,
        "lastModified":1615254463000,
        "channelSessionId":null,
        "sort":6,
        "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/1b448be32316137918188520c60km1bdhf9?auth_key=1615258732-0-0-52776ade7d496c0bd8c2da61d80cc0e1"
    }
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询
在线咨询