Polyv Help Center

Help Center

Upload Pseudo-Live Interactive Script Glossary Text

Updated: 2025-05-13 09:20:33

Interface Description

1、上传伪直播互动脚本精准发言文件
2、伪直播脚本不存时,会自动创建
3、文件内容解析添加到该互动脚本下
4、接口支持https协议

Template File Download

Precise Speech Template.xlsx

Interface URL

http://api.polyv.net/live/v4/channel/interaction-script/upload-disk-video-custom-script

Request Method

POST

Interface Constraints

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

  2. The uploaded file must not exceed 200MB, and the format is limited to xlsx.

Request Parameter Description

Parameter Name 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 never be saved 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
channelId true String Channel ID
diskVideoId true String Pseudo-live video ID
labelId false Long Platform content library - member library - member group ID. Obtain via Platform Content Library Group List
file true File Uploaded template file, must not exceed 10MB

Example

http://api.polyv.net/live/v4/channel/interaction-script/upload-disk-video-custom-script

Request Parameters:

channelId=1965681&timestamp=1621842842327&diskVideoId=test&appId=frlr1zazn3&sign=FC2296E942D2DB118C64C11AD941445D

Form Parameters:

file=file

Response Parameter Description

Parameter Name Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See global error description
status String Response status text
message String Response description. When code is 400 or 500, provides auxiliary error description
data Object On success, contains information about the uploaded document. See Data parameter description. On failure, it is empty.
Data Parameter Description
Parameter Name Type Description
id Integer Script ID

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 code project. The test cases include HttpUtil.java and LiveSignUtil.java, both contained in the downloaded file.

It is strongly recommended to use the Live Java SDK for API 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(ChannelDocTest.class);
/**
 * 上传互动脚本精准发言
 * @throws IOException
 */
@Test
public void testUpload() 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/interaction-script/upload-disk-video-custom-script";
    String channelId = "1965681";
    String diskVideoId = "diskVideoId";
    File file = new File("D:/%E7%B2%BE%E5%87%86%E5%8F%91%E8%A8%80%E6%A8%A1%E6%9D%BF.xlsx");
    
    //http 调用逻辑
    Map<String,String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp",timestamp);
    requestMap.put("channelId",channelId);
    requestMap.put("diskVideoId",diskVideoId);
    Map<String,File> fileMap = new HashMap<>();
    fileMap.put("file",file);
    String sign = LiveSignUtil.getSign(requestMap, appSecret);
    url += "?appId="+appId+"&timestamp="+timestamp+"&channelId="+channelId+"&sign="+sign+"&diskVideoId="+diskVideoId;
    String response = HttpUtil.postFile(url, null, fileMap,"utf-8");
    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":{
        "id":"scriptId"
    }
}

Error Example

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