获取频道文档详情信息
更新时间:2022-09-02 18:08:07
接口URL
https://api.polyv.net/live/v3/channel/document/get
接口说明
1、接口用于频道的文档详情信息
2、接口支持https
支持格式
JSON
请求方式
GET
请求参数
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | 是 | string | 管理员的appId |
| timestamp | 是 | long | 13位当前时间戳 |
| sign | 是 | String | 签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则】 |
| channelId | 是 | int | 频道id |
| fileId | 是 | string | 文件ID |
| type | 否 | string | 文档新旧类型(新版:new, 旧版 :old),不传默认为new |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"autoId": xxxx,
"fileId": "6fcf5fa1c48bf427515a0fe47d3b3a5d330282",
"fileName": "xxxx.ppt",
"fileUrl": "http://doc.polyv.net/xxxx.ppt",
"fileType": '.ppt',
"totalPage": 1,
"channelId": "330282",
"status": "normal",
"createTime": null,
"convertType": "common",
"type": "old",
"previewImage": "http://doc.polyv.net/xxxx_s.jpeg",
"previewBigImage": "http://doc.polyv.net/xxxx.jpeg",
"images": ["http://doc.polyv.net/xxxx.jpeg"],
"smallImages": ["http://doc.polyv.net/xxxx_s.jpeg"]
}
}
响应失败JSON示例:
未输入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正确
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
时间戳错误
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
字段说明
| 参数名 | 说明 |
|---|---|
| code | 响应代码,成功为200,失败为400,签名错误为403,异常错误500 |
| status | 成功为success,失败为error |
| message | 错误时为错误提示消息 |
| data.channelId | 频道号 |
| data.autoId | ppt自增ID |
| data.fileId | ppt文件ID |
| data.fileName | 文件名 |
| data.fileType | 文件类型 |
| data.fileUrl | 文件地址 |
| data.totalPage | 总页数 |
| data.status | PPT状态(‘normal’:正常,“waitUpload”:等待上传,“failUpload”:上传失败,"waitConvert":转换PPT中,"failConvert":转换PPT失败 ) |
| data.convertType | 转换类型,(普通: "common", 动画: "animate") |
| data.type | ppt新旧类型(新版ppt:"new", 旧版ppt:"old") |
| data.previewImage | 预览小图 |
| data.previewBigImage | 预览大图 |
| data.images | 大图列表 |
| data.smallImages | 小图列表 |
请求示例
<?php
//引用config.php
include 'config.php';
//接口URL上变量
$channelId = "123456";
$fileId = "xxxxxxxx";
//接口需要的参数(非sign)赋值
$params = array(
'appId'=>$appId,
'timestamp'=>$timestamp,
'channelId'=>$channelId,
'fileId'=>$fileId
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
//接口请求url
$url = "http://api.polyv.net/live/v3/channel/document/get?appId=".$appId."&sign=".$sign."×tamp=".$timestamp."&channelId=".$channelId."&fileId=".$fileId;
//输出接口请求结果
echo file_get_contents($url);
?>
