Polyv Help Center

Help Center

Batch Set Check-in Function

Updated: 2025-01-16 16:29:28

API Description

1、批量设置签到功能
2、接口支持https协议

API URL

http://api.polyv.net/live/v4/chat/batch-checkin

<a href="/req.html?api=http://api.polyv.net/live/v4/chat/batch-checkin"" target="_blank">Online API Call

Request Method

POST

API Constraints

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

  2. A maximum of 1000 items can be set at a time

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details for obtaining 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 saved or used directly on the client side. All APIs must be relayed through the customer's own server to call the POLYV server for response data. See details for signature generation rules

Request Body Parameter Description

Parameter Required Type Description
channelId true Integer Live channel ID
limitTime false Integer Check-in duration (seconds, 0-86400). If not passed or set to 0, check-in is immediate
delayTime false Long Scheduled start time (13-digit timestamp). If not passed, starts immediately after API setup succeeds
message false String Check-in prompt message
forceCheckInEnabled false String Whether to force check-in, default N (Y/N)

Example

http://api.polyv.net/live/v4/chat/batch-checkin?appId=frlr1zazn3&sign=FD701BFA3DCE2C7DCC362A904DBF48B0&timestamp=1636536555144

Request body JSON parameters:

[
  {
    "channelId":4032639,
    "limitTime":30,
    "delayTime":1700734800000,
    "message":"tips1"
  },
  {
    "channelId":4032640,
    "limitTime":30,
    "delayTime":1700734800000,
    "message":"tips2"
  }
]

Response Parameter Description

Parameter Type Description
code Integer
status String
requestId String
error Error
data Boolean

Java Request Example

For quick integration of basic code, download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. HttpUtil.java and LiveSignUtil.java in the test cases are included in the download file.

It is strongly recommended to use the Live Java SDK for API function 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(getClass());

    @Test
    public void testBatchCheckin() 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/chat/batch-checkin";
        
        //http 调用逻辑
        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        
        requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
        
        String body = "[{"channelId":4032639,"limitTime":30,"delayTime":1700734800000},{"channelId":4032640,"limitTime":30,"delayTime":1700734800000}]";
        url = HttpUtil.appendUrl(url, requestMap);
        String response = HttpUtil.postJsonBody(url,body,null);
        
        log.info("测试批量设置签到功能,返回值:{}", response);
        //do somethings
        
    }

Response Example

For system-wide error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "62af5d29-a836-4bfb-8c4d-cbd6a84ea7e9",
    "data": true,
    "success": true
}

Error Example

{
  "code": 400,
  "status": "error",
  "requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
  "error": {
    "code": 20001,
    "desc": "application not found."
  },
  "success": false
}
{
  "code": 400,
  "status": "error",
  "requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
  "error": {
    "code": 1097,
    "desc": "非法的频道ID"
  },
  "success": false
}
{
  "code": 400,
  "status": "error",
  "requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
  "error": {
    "code": 1099,
    "desc": "签到失败: 序号为[0],时间区间存在重叠或时间区间间隔小于5秒,不允许添加"
  },
  "success": false
}
{
  "code": 400,
  "status": "error",
  "requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
  "error": {
    "code": 1099,
    "desc": "签到失败: 序号为[0,2],签到失败"
  },
  "success": false
}
联系客服,在线咨询