New Oriental - Upload PPT File
Updated: 2023-11-14 14:07:19
Interface URL
https://document-2.polyv.net/api/live/user/upload/ppt
Interface Description
- Upload PPT file
- Interface supports HTTPS protocol
Supported Format
JSON
Request Method
POST
Request Limit
TRUE
Request Parameters (FORM)
| Parameter | Required | Type | Description |
|---|---|---|---|
| userId | Yes | string | User ID |
| type | Yes | string | PPT type, "common" for normal PPT, "animate" for animated PPT |
| callback | No | string | Callback URL |
| file | Yes | file | Upload file |
| timestamp | Yes | long | Timestamp |
| sign | Yes | string | Signature, signing method: MD5 uppercase of the string 'POLYV_USER_PPT' + 'userId' + userId + 'timestamp' + timestamp + 'POLYV_USER_PPT' |
Successful Response JSON Example:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"autoId": 1539983,
"fileId": "3872476de0879e8a3d76ecc344b899b1cf7f07e096animate",
"fileName": "123.pptx",
"fileUrl": "http://doc-2.polyv.net/sources/20201202/3872476de0879e8a3d76ecc344b899b1cf7f07e096animate.pptx",
"fileType": ".pptx",
"totalPage": null,
"channelId": "cf7f07e096",
"status": "waitConvert",
"createTime": 1606890386168,
"convertType": "animate",
"smallImagesZip": null,
"imagesZip": null,
"htmlUrlZip": null
}
}
Failed Response JSON Example:
{
"code": 400,
"status": "error",
"message": "file type is wrong",
"data": ""
}
Field Description
| Parameter | Description |
|---|---|
| code | Request status response code |
| status | Request status |
| message | Error message |
| data | Empty on failure, success information on success |
| data.autoId | Record ID |
| data.fileId | File ID |
| data.status | PPT status, "normal" - normal, no need to re-upload, same PPT already uploaded successfully, can proceed to polling. "waitConvert" - converting PPT, same file is being converted, proceed to polling. "waitUpload" - waiting to upload, proceed to Alibaba Cloud upload step. "failConvert" - conversion failed |
| data.fileUrl | File URL |
| data.fileType | File type |
| data.totalPage | Total pages |
| data.convertType | Conversion type |
| data.smallImagesZip | Small image ZIP URL |
| data.imagesZip | Large image ZIP URL |
| data.htmlUrlZip | Animation file ZIP URL |
| data.fileName | File name |
Callback Description
- After PPT conversion is complete, data is sent via POST to the user's callback URL
- The user must respond with the callback processing result upon successful receipt
- If no successful response is received, a second and third callback will be initiated at intervals of 5 seconds and 10 seconds
Callback Request Data JSON Example:
{
"autoId": 1539983,
"fileId": "3872476de0879e8a3d76ecc344b899b1cf7f07e096animate",
"fileName": "123.pptx",
"fileUrl": "http://doc-2.polyv.net/sources/20201202/3872476de0879e8a3d76ecc344b899b1cf7f07e096animate.pptx",
"fileType": ".pptx",
"totalPage": 2,
"channelId": "cf7f07e096",
"status": "normal",
"createTime": 1606890386000,
"convertType": "animate",
"smallImagesZip": "http://doc-2.polyv.net/images/2020/12/3872476de0879e8a3d76ecc344b899b1cf7f07e096animate/smallImages.zip",
"imagesZip": "http://doc-2.polyv.net/images/2020/12/3872476de0879e8a3d76ecc344b899b1cf7f07e096animate/images.zip",
"htmlUrlZip": "http://doc-2.polyv.net/images/2020/12/3872476de0879e8a3d76ecc344b899b1cf7f07e096animate/3872476de0879e8a3d76ecc344b899b1cf7f07e096animate.zip"
}
Callback Data Description
| Field | Description |
|---|---|
| autoId | Record ID |
| fileId | File ID |
| status | PPT status, "normal" - normal, no need to re-upload, same PPT already uploaded successfully, can proceed to polling. "waitConvert" - converting PPT, same file is being converted, proceed to polling. "waitUpload" - waiting to upload, proceed to Alibaba Cloud upload step. "failConvert" - conversion failed |
| fileUrl | File URL |
| fileType | File type |
| totalPage | Total pages |
| convertType | Conversion type |
| smallImagesZip | Small image ZIP URL |
| imagesZip | Large image ZIP URL |
| htmlUrlZip | Animation file ZIP URL |
| fileName | File name |
Callback Response Data JSON Example:
{
"code": 200
}
Response Field Description
| Parameter | Description |
|---|---|
| code | Request status response code, returning 200 indicates successful receipt |
Java Request Example
public static void test() {
String url = "https://document-2.polyv.net/api/live/user/upload/ppt";
Map<String, String> params = new HashMap<>();
params.put("callback", "http://biny.free.idcfengye.com/callback/ppt");
params.put("type", "animate");
params.put("userId", "cf7f07e096");
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance().sendHttpPost(url, params);
System.out.println(content);
}
