Polyv Help Center

Help Center

Query Courseware

Updated: 2025-01-14 16:02:07

API Description

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

API URL

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

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have a frequency limit. See details

Request Parameters

Parameter Required Type Description
ptime true Long Current time in milliseconds, valid within 3 minutes
sign true String Signature, a 40-character uppercase SHA1 value. The secretkey used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See signature generation rules
vid true String Video ID, e.g., 1b448be323dec2a7bed6db61bd7d8a77_1

Example

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

Response Parameters

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See global error description
status String Response status text
message String Response description, provides error details when code is 400 or 500
data Array Courseware information on success See Data field description, empty on failure
Data Parameter Description
Parameter Type Description
pageNo Integer Courseware page number
pageTitle String Courseware page title
pageImage String URL of the transcoded image for a courseware page
pageThumbnail String URL of the thumbnail for a courseware page
showTime Integer Time in seconds when the courseware page is displayed during video playback

Error Code List

Error Code message Description
400 sign can not be empty. Signature is empty
400 ptime is too old. Timestamp has expired
400 ptime is illegal. Timestamp format is incorrect or exceeds 3 minutes from current time
400 Could not find user by userid. User ID does not exist
400 the sign is not right. Signature is incorrect
400 该视频尚未关联课件 The video has no associated courseware

Java Request Example

HttpUtil.java and VodSignUtil.java base code can be downloaded here or obtained online at Base Code

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

}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "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
    }]
}

Error Example

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}
联系客服,在线咨询
在线咨询