Synchronous Upload Courseware
Updated: 2026-01-16 00:02:40
API Description
1、通过视频id上传课件,支持ppt、pptx及pdf文件格式
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
API URL
http://api.polyv.net/v2/video/{userid}/uploadPPT
Request Method
POST
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have frequency limits. See details
Both the PPT file and the TXT file must be uploaded simultaneously.
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| ptime | true | Long | Current time in milliseconds timestamp, valid within 3 minutes |
| sign | true | String | Signature, a 40-character uppercase SHA1 value. The secretkey used to generate the signature is critical for communication data security. It must never be 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 |
| vid | true | String | Video ID, e.g., 1b448be323dec2a7bed6db61bd7d8a77_1 |
| ppt | true | File | Courseware file, supports ppt, pptx, pdf formats. File size must not exceed 50MB |
| txt | true | File | Controls which slide of the courseware is displayed at a specific second of the video. File format is TXT, must be UTF-8 encoded, otherwise chapter titles may display as garbled characters |
TXT file format example: each line is "seconds in video" + ":" + "title"
10:第十秒出现标题
21:第二十秒出现标题
30:第三十秒出现标题
Example
http://api.polyv.net/v2/video/1b448be323/uploadPPT
Form parameters:
vid=1b448be323fb327a42539cbb788913b4_1&format=json&sign=173B5BBA359A47A8FD00FD671CB87EAE492052BF&ptime=1617332188260
The courseware file is uploaded to the server as a binary stream over HTTP.
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 | String | Returns "ppt upload successful" on success, empty on failure |
Java Request Example
HttpUtil.java and VodSignUtil.java base code can be downloaded locally or obtained online at base code
private static final Logger log = LoggerFactory.getLogger(VodVideoCourseWare.class);
/**
* 同步上传课件
*/
@Test
public void testUploadCourseWareSync() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userid = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/video/%s/uploadPPT",userid);
String vid = "1b448be323fb327a42539cbb788913b4_1";
String format = "json";
String pptFilePath = getClass().getResource("/file/").getPath() + "class.pptx";
String pptControlPath = getClass().getResource("/file/").getPath() + "pptControl.txt";
File ppt = new File(pptFilePath);
File txt = new File(pptControlPath);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
requestMap.put("format",format);
Map<String,File> fileMap = new HashMap<>();
fileMap.put("ppt",ppt);
fileMap.put("txt",txt);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFile(url, requestMap,fileMap,Constant.UTF8);
log.debug("测试同步上传课件,{}", response);
//do somethings
}
Response Example
See global error description for system-wide error details.
Success example
{
"code": 200,
"status": "success",
"message": "success",
"data": "ppt上传成功"
}
Error example
{
"code": 400,
"status": "error",
"message": "sign can not be empty.",
"data": ""
}
