Polyv Help Center

Help Center

Query Channel Role Viewer Settings

Updated: 2024-07-29 17:49:20

API Description

1、查询频道角色观众设置信息
2、接口支持https协议

API URL

http://api.polyv.net/live/v4/channel/account/viewer/get

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details: Get Secret Key
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 details: Signature Generation Rules
channelId true String Channel ID

Example

http://api.polyv.net/live/v4/channel/account/viewer/get?appId=frlr1zazn3&sign=AE9DED64FDDC94A0B18DB29E2D9B7DFC&channelId=3151318&timestamp=1654828588317

Response Parameter Description

Parameter Type Description
code Integer Status code, same as HTTP status code, used to determine the basic response status
status String Response result, determined by the business. Returns "success" on success, "error" on failure
success Boolean Whether the response was successful
requestId String Request ID, a unique UUID generated for each request. Only used for troubleshooting and debugging, not for business logic
error Object Error information when status code is not 200 See details: Error Field Description
data Object See details: data field description

Error Parameter Description

Parameter Type Description
code Integer Error code, used to identify the specific error reason
desc String Error description, corresponding to error.code

data Field Description

Parameter Type Description
actor String Title
actorEnabled String Title toggle, Y for enabled, N for disabled
questionStudentTitle String Question area label name
questionStudentTitleEnabled String Question area label toggle, Y for enabled, N for disabled

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 integration. The Live Java SDK provides unified packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pooling.

private static final Logger log = LoggerFactory.getLogger(getClass());
/**
 * 查询频道角色观众设置信息
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testGetChannelAccountViewerInfo() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String userId = super.userId;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/live/v4/channel/account/viewer/get";
    String channelId = "3151318";
    
    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));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询频道角色观众设置信息,返回值:{}", response);
    //do somethings
    
}

Response Example

For system-wide error descriptions, see Global Error Description

Success Example

{
  "code": 200,
  "status": "success",
  "requestId": "089f1962c0c64e15b1c0619f36133092.72.17222397868660083",
  "data": {
    "questionStudentTitleEnabled": "Y",
    "questionStudentTitle": "学生",
    "actorEnabled": "N",
    "actor": "学生"
  },
  "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "error": {
        "code": 10003,
        "desc": "时间戳过期"
    },
    "success": false
}
联系客服,在线咨询