新东方-上传PPT文件
接口URL
https://document-2.polyv.net/api/live/user/upload/ppt
接口说明
1、上传PPT文件
2、接口支持https协议
支持格式
JSON
请求方式
POST
请求数限制
TRUE
请求参数(FORM表单)
userId
是
string
用户ID
type
是
string
PPT类型,“common” 普通ppt , “animate”动画PPT
callback
否
string
回调地址
file
是
file
上传文件
timestamp
是
long
时间戳
sign
是
string
签名,签名方式:'POLYV_USER_PPT'+ 'userId' + userId + 'timestamp' + timestamp + 'POLYV_USER_PPT' 字符串进行MD5大写
响应成功JSON示例:
{
"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
}
}
响应失败JSON示例:
{
"code": 400,
"status": "error",
"message": "file type is wrong",
"data": ""
}
字段说明
code
请求状态响应码
status
请求状态
message
错误信息
data
请求失败时为空,请求成功为成功信息
data.autoId
记录ID
data.fileId
文件ID
data.status
PPT状态,“normal” 正常,不需要重复上传文件,已经有上传成功的相同PPT,可以直接进入轮询。“waitConvert”转换PPT中,已经有相同的文件正在转换中,直接进入轮询。“waitUpload” 等待上传状态,进入上传阿里云步骤。“failConvert” 转换失败
data.fileUrl
文件地址
data.fileType
文件类型
data.totalPage
总页数
data.convertType
转换类型
data.smallImagesZip
小图ZIP地址
data.imagesZip
大图ZIP地址
data.htmlUrlZip
动效文件ZIP地址
data.fileName
文件名
回调说明
1、PPT转换完成后通过POST方式间数据回调到用户的callback地址
2、用户成功接收回调后需要响应回调处理结果
3、没有接收到成功的响应回调结果,间隔5秒、10秒后会发起第二、第三次回调
回调请求数据JSON示例:
{
"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"
}
回调数据说明
autoId
记录ID
fileId
文件ID
status
PPT状态,“normal” 正常,不需要重复上传文件,已经有上传成功的相同PPT,可以直接进入轮询。“waitConvert”转换PPT中,已经有相同的文件正在转换中,直接进入轮询。“waitUpload” 等待上传状态,进入上传阿里云步骤。“failConvert” 转换失败
fileUrl
文件地址
fileType
文件类型
totalPage
总页数
convertType
转换类型
smallImagesZip
小图ZIP地址
imagesZip
大图ZIP地址
htmlUrlZip
动效文件ZIP地址
fileName
文件名
回调响应数据JSON示例:
{
"code": 200
}
响应字段说明
code
请求状态响应码,返回200成功表示收到响应
java请求示例
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);
}
Last updated
Was this helpful?