Polyv Help Center

Help Center

Query Quiz Questions for a Single Video

Updated: 2026-01-20 14:07:15

API Description

1、通过视频id查询单个视频的问答题目
2、接口支持https协议

API URL

http://api.polyv.net/v2/video/get-video-exam

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls are subject to rate limits. See details

Request Parameter Description

Parameter Required Type Description
userid true String POLYV VOD account ID. Refer to Get Secret Key for acquisition. Path: Official Website -> Login -> VOD (API Interface)
ptime true Long Current time in milliseconds, valid for 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 and must not be stored or used directly on the client side. All APIs must be relayed through the customer's own server to call the POLYV server and obtain response data. See Signature Generation Rules
vid true String Video ID

Example

http://api.polyv.net/v2/video/get-video-exam

Form Parameters:

vid=1b448be3231ebf0005ec631a7e4247ee_1&sign=738445A034D8F70D3625E0C761EE26A4E9F3446B&userid=1b448be323&ptime=1620287966337

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See Global Error Description
status String Response status text
message String Response description. When code is 400 or 500, provides auxiliary error reason
data Object Returns the quiz record array on success, empty on failure. See data field description

data Field Description

Field Type Description
exams Array Quiz list. See exams field description

exams Field Description

Field Type Description
vid String Video ID
examId String Quiz ID
showTime Integer Time when the quiz appears, in seconds
qustion String Quiz question description
choices String Quiz options content, formatted as a JSON array. Maximum of 5 options per question
canSkip Boolean Whether skipping is allowed. Default: false
explanationIfRight String Explanation displayed after a correct answer
showExplanationIfWrong String Whether to display explanation after an incorrect answer
explanationIfWrong Boolean Explanation displayed after an incorrect answer
backTime Integer Seconds to rewind after an incorrect answer. -1 means no rewind. Default: -1
status Integer Whether valid. 1: valid, 0: invalid. Default: 1
type Integer Question type. 0: Multiple choice, 1: Listening question (Listening questions will be deprecated soon)
mp3url String MP3 audio file URL for listening questions (Listening questions will be deprecated soon)
illustration String Quiz image URL
createdTime Long Quiz creation time, in 13-digit timestamp format, e.g., 1767003468000

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download source code. After downloading, add it to your own source project. The test case files HttpUtil.java and VodSignUtil.java are included in the download package.

It is strongly recommended to use the VOD Java SDK for API integration. The VOD Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

private static final Logger log = LoggerFactory.getLogger(VodVideoManageManagementTest.class);
/**
 * 查询问答题目
 */
@Test
public void testGetQuizResult() throws Exception, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String secretKey = super.secretKey;
    String userId = super.userId;
    String ptime = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/v2/video/get-video-exam";
    String vid = "1b448be3231ebf0005ec631a7e4247ee_1";

    //调用参数
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("userid", userId);
    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 something
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code":200,
    "status":"success",
    "message":"success",
    "data":{
        "exams":[
            {
                "examId":"179407cbb9b",
                "vid":"1b448be3231ebf0005ec631a7e4247ee_1",
                "showTime":3,
                "question":"测试删除问答",
                "choices":"[{\"index\":0,\"content\":\"1\",\"right\":false},{\"index\":1,\"content\":\"2\",\"right\":true}]",
                "explanationIfRight":"123",
                "explanationIfWrong":"321",
                "showExplanationIfWrong":true,
                "backTime":1,
                "canSkip":true,
                "illustration":null,
                "type":0,
                "mp3Url":"",
                "status":1,
                "createdTime":1620284587000
            },
            {
                "examId":"1794097a449",
                "vid":"1b448be3231ebf0005ec631a7e4247ee_1",
                "showTime":2,
                "question":"测试创建问答题目?",
                "choices":"[{\"index\":0,\"content\":\"a\",\"right\":true},{\"index\":1,\"content\":\"b\",\"right\":false},{\"index\":2,\"content\":\"c\",\"right\":false}]",
                "explanationIfRight":"答对啦",
                "explanationIfWrong":"答错了",
                "showExplanationIfWrong":true,
                "backTime":1,
                "canSkip":false,
                "illustration":null,
                "type":0,
                "mp3Url":"",
                "status":1,
                "createdTime":1620286350000
            }
        ]
    }
}

Error Example

Incorrect Signature

{
    "code": 400,
    "status": "error",
    "message": "the sign is not right",
    "data": ""
}

Timestamp Expired

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