# 查询课件

### 接口描述

```
1、通过视频id获取视频关联课件信息
2、接口URL中的{userid}为点播账号userid，具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
```

### 接口URL

```
http://api.polyv.net/v2/video/{userid}/getPPTPage
```

[在线API调用](https://git.polyv.net/help-center/document-center/-/blob/master/req.html?api=http:/api.polyv.net/v2/video/%7Buserid%7D/getPPTPage/README.md)

### 请求方式

```
GET
```

### 接口约束

1、接口同时支持HTTP 、HTTPS ，建议使用HTTPS 确保接口安全，接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/limit/README.md)

### 请求参数描述

| 参数名    | 必选   | 类型     | 说明                                                                                                                                                                                                        |
| ------ | ---- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| userid | true | String | 保利威点播账户id，可以参考【[获取密钥](https://git.polyv.net/help-center/document-center/-/blob/master/vod/vod/api/getSecretKey/README.md)】获取,获取路径：官网->登录->点播（API接口）                                                       |
| ptime  | true | Long   | 当前时间的毫秒级时间戳，3分钟内有效                                                                                                                                                                                        |
| sign   | true | String | 签名，为40位大写的SHA1值,`生成签名的secretkey密钥作为通信数据安全的关键信息，严禁保存在客户端直接使用，所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据`【详见[签名生成规则](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/buildSign/README.md)】 |
| vid    | true | String | 视频id，例如：1b448be323dec2a7bed6db61bd7d8a77\_1                                                                                                                                                               |

### 示例

```requestUrl
http://api.polyv.net/v2/video/1b448be323/getPPTPage?vid=1b448be3239482977934f099f2ceaa0a_1&sign=7CA059DC9F8359A0C96BAEC2E2B0A53D7772D416&ptime=1617674841740
```

### 响应参数描述

| 参数名     | 类型      | 说明                                                                                                                                                                  |
| ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| code    | Integer | 响应状态码，200为成功返回，非200为失败【详见[全局错误说明](https://git.polyv.net/help-center/document-center/-/blob/master/vod/vod/api/errorInfo/README.md)】                                 |
| status  | String  | 响应状态文本信息                                                                                                                                                            |
| message | String  | 响应描述信息，当code为400或者500的时候，辅助描述错误原因                                                                                                                                   |
| data    | Array   | 响应成功时返回课件信息【详见[Data字段说明](https://git.polyv.net/help-center/document-center/-/blob/master/vod/api/video_management/courseware/get_courseware.md?id=polyv1)】，响应失败时返回空 |

[**Data参数描述**](#/vod/api/video_management/courseware/get_courseware.md?id=polyv1)

| 参数名           | 类型      | 说明                   |
| ------------- | ------- | -------------------- |
| pageNo        | Integer | 课件页码                 |
| pageTitle     | String  | 课件页面标题               |
| pageImage     | String  | 课件某页转码后的图片URL链接      |
| pageThumbnail | String  | 课件某页缩略图URL链接         |
| showTime      | Integer | 视频播放到第几秒时显示该页课件，单位：秒 |

### 返回错误代码列表

| 错误代码 | message                        | 说明                   |
| ---- | ------------------------------ | -------------------- |
| 400  | sign can not be empty.         | 加密串为空                |
| 400  | ptime is too old.              | 时间戳过期                |
| 400  | ptime is illegal.              | 时间戳参数格式不对或者超过当前时间3分钟 |
| 400  | Could not find user by userid. | userid不存在            |
| 400  | the sign is not right.         | 加密串不正确               |
| 400  | 该视频尚未关联课件                      | 该视频尚未关联课件            |

### Java请求示例

**HttpUtil.java 和 VodSignUtil.java** 基础代码请[点击下载本地](https://git.polyv.net/help-center/document-center/-/blob/master/third_res/util.zip) 或跳转到[基础代码](https://git.polyv.net/help-center/document-center/-/blob/master/vod/vod/api/quickAccess?id=_2%E7%B3%BB%E7%BB%9F%E5%9F%BA%E7%A1%80%E4%BB%A3%E7%A0%81/README.md)在线获取

```java
private static final Logger log = LoggerFactory.getLogger(VodVideoCourseWare.class);
/**
 *  查询课件
 */
@Test
public void testGetCourseWare() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String secretKey = super.secretKey;
    String userid = super.userId;
    String ptime = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = String.format("https://api.polyv.net/v2/video/%s/getPPTPage", userid);
    String vid = "1b448be3239482977934f099f2ceaa0a_1";

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("ptime", ptime);
    requestMap.put("vid", vid);
    requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));

    String response = HttpUtil.get(url, requestMap);
    log.debug("测试查询课件，{}", response);
    //do somethings

}
```

### 响应示例

系统全局错误说明详见[全局错误说明](https://git.polyv.net/help-center/document-center/-/blob/master/vod/vod/api/errorInfo/README.md)

成功示例

```json
{
	"code": 200,
	"status": "success",
	"message": "success",
	"data": [{
		"pageNo": 1,
		"pageTitle": "hello,word",
		"pageImage": "https://doc-oss.polyv.net/images/2021/04/736cde140f73437997729a1066140cf1e6bdefb8/736cde140f73437997729a1066140cf1e6bdefb8_0000.jpeg",
		"pageThumbnail": "https://doc-oss.polyv.net/images/2021/04/736cde140f73437997729a1066140cf1e6bdefb8/736cde140f73437997729a1066140cf1e6bdefb8_0000_s.jpeg",
		"showTime": 0
	}, {
		"pageNo": 2,
		"pageTitle": "hello,word",
		"pageImage": "https://doc-oss.polyv.net/images/2021/04/736cde140f73437997729a1066140cf1e6bdefb8/736cde140f73437997729a1066140cf1e6bdefb8_0001.jpeg",
		"pageThumbnail": "https://doc-oss.polyv.net/images/2021/04/736cde140f73437997729a1066140cf1e6bdefb8/736cde140f73437997729a1066140cf1e6bdefb8_0001_s.jpeg",
		"showTime": 0
	}, {
		"pageNo": 3,
		"pageTitle": "hello,word",
		"pageImage": "https://doc-oss.polyv.net/images/2021/04/736cde140f73437997729a1066140cf1e6bdefb8/736cde140f73437997729a1066140cf1e6bdefb8_0002.jpeg",
		"pageThumbnail": "https://doc-oss.polyv.net/images/2021/04/736cde140f73437997729a1066140cf1e6bdefb8/736cde140f73437997729a1066140cf1e6bdefb8_0002_s.jpeg",
		"showTime": 0
	}]
}
```

异常示例

```json
{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}
```
