New Oriental - Get Upload PPT File Token
Updated: 2023-11-14 14:07:19
Interface URL
https://document-2.polyv.net/api/live/user/upload/token
Interface Description
- Get the token for uploading PPT files.
- The interface supports the HTTPS protocol.
- For uploading files to OSS, refer to https://www.alibabacloud.com/help/zh/doc-detail/31927.htm.
Supported Format
JSON
Request Method
GET
Request Rate Limit
TRUE
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| fileId | Yes | string | File ID (file MD5 + userId + type) |
| userId | Yes | string | User ID |
| type | Yes | string | PPT type, "common" for normal PPT, "animate" for animated PPT |
| fileName | Yes | string | File name |
Successful Response JSON Example:
Waiting to upload
{
"code": 200,
"status": "success",
"message": "",
"data": {
"encodedCallback": "eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9kb2N1bWVudC0yLnBvbHl2Lm5ldC90ZXN0L2FsaS9vc3MvY2FsbGJhY2svdXBsb2FkIiwiY2FsbGJhY2tIb3N0IjoiZG9jdW1lbnQtMi5wb2x5di5uZXQiLCJjYWxsYmFja0JvZHkiOiJvYmplY3Q9JHtvYmplY3R9JnNpemU9JHtzaXplfSZidWNrZXQ9JHtidWNrZXR9JmV0YWc9JHtldGFnfSZhdXRvSWQ9MTQ5MzcxNyZmaWxlSWQ9ZDg3MDBhODhhZGUxMDUyOTQwMTM3MDM4MTBmY2ZjMTNjZjdmMDdlMDk2YW5pbWF0ZSIsImNhbGxiYWNrQm9keVR5cGUiOiJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQifQ==",
"signature": "fcrT21oNF7CMxAdI70D20hUu1fE=",
"autoId": "1493717",
"dir": "sources/20201028/",
"bucket": "polyvppt",
"accessId": "LTAIjy1Mrh8QQcQH",
"endpoint": "oss-cn-shenzhen.aliyuncs.com",
"expire": "1603941652",
"host": "http://polyvppt.oss-cn-shenzhen.aliyuncs.com",
"callback": "{\"callbackUrl\":\"http://document-2.polyv.net/test/ali/oss/callback/upload\",\"callbackHost\":\"document-2.polyv.net\",\"callbackBody\":\"object=${object}&size=${size}&bucket=${bucket}&etag=${etag}&autoId=1493717&fileId=d8700a88ade105294013703810fcfc13cf7f07e096animate\",\"callbackBodyType\":\"application/x-www-form-urlencoded\"}",
"convertStatus": "waitUpload",
"fileId": "d8700a88ade105294013703810fcfc13cf7f07e096animate",
"object": "sources/20201028/d8700a88ade105294013703810fcfc13cf7f07e096animate.pptx",
"policy": "eyJleHBpcmF0aW9uIjoiMjAyMC0xMC0yOVQwMzoyMDo1Mi42OTJaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMzIyMTIyNTQ3MjBdLFsic3RhcnRzLXdpdGgiLCIka2V5Iiwic291cmNlcy8yMDIwMTAyOC8iXV19"
}
}
Waiting to convert
{
"code": 200,
"status": "success",
"message": "",
"data": {
"autoId": "1492485",
"convertStatus": "waitConvert",
"fileId": "18947167af136724418f3cfa32343b29cf7f07e096animate"
}
}
Conversion successful
{
"code": 200,
"status": "success",
"message": "",
"data": {
"autoId": "1493717",
"convertStatus": "normal",
"fileId": "d8700a88ade105294013703810fcfc13cf7f07e096animate"
}
}
Failed Response JSON Example:
File type error
{
"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 request failure, success information on request success |
| data.autoId | Record ID |
| data.fileId | File ID |
| data.convertStatus | PPT status, "normal" - normal, no need to re-upload the file, an identical PPT has been successfully uploaded, can directly enter polling. "waitConvert" - converting PPT, an identical file is being converted, directly enter polling. "waitUpload" - waiting to upload, proceed to Alibaba Cloud upload step. "failConvert" - conversion failed |
| data.accessId | OSS upload OSSAccessKeyId |
| data.signature | OSS upload signature |
| data.policy | OSS upload policy |
| data.endpoint | OSS upload endpoint |
| data.encodedCallback | OSS upload callback parameter BASE64 encoded |
| data.callback | OSS upload callback parameter |
| data.object | OSS upload document key |
| data.host | OSS upload address |
| data.bucket | OSS upload bucket |
| data.expire | OSS upload validity period |
| data.dir | Folder to upload to OSS |
Java Request Example
public static void test() {
String url = "https://document-2.polyv.net/api/live/user/upload/token";
Map<String, String> params = new HashMap<>();
params.put("fileId", "d8700a88ade105294013703810fcfc13cf7f07e096animate");
params.put("type", "animate");
params.put("fileName", "animate.pptx");
params.put("userId", "cf7f07e096");
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance().sendHttpPost(url, params);
System.out.println(content);
}
