保利威文档中心

帮助中心

获取单个视频的问答题目

更新时间:2022-05-23 19:02:59

接口URL

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

接口说明

获取单个视频的问答题目

支持格式

JSON

请求方式

POST

请求参数

参数名 必选 类型及范围 说明
userid string 用户ID
ptime long 当前时间的毫秒级时间戳(13位),3分钟内有效
sign String 签名,为40位大写的SHA1值【详见签名生成规则
vid string 视频ID

返回正确结果JSON示例

{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": {
        "exams": [
            {
                "examId": "17922407aac",
                "vid": "a2dc4f25172872650e7d5c1b8026b13c_a",
                "showTime": 12,
                "question": "测试问题",
                "choices": "[{\"index\":0,\"content\":\"a\",\"right\":true},{\"index\":1,\"content\":\"b\",\"right\":false},{\"index\":2,\"content\":\"c\",\"right\":false},{\"index\":3,\"content\":\"d\",\"right\":true}]",
                "explanationIfRight": "回答正确后的解答详情",
                "explanationIfWrong": "回答错误后的解答详情",
                "showExplanationIfWrong": false,
                "backTime": -1,
                "canSkip": false,
                "illustration": "",
                "type": 0,
                "mp3Url": "",
                "status": 1,
                "createdTime": 1619777319000
            }
        ]
    }
}

返回错误结果JSON示例

签名不正确
{
"code":400,
"status":"error",
"message":"the sign is not right",
"data":""
}
时间戳过期
{
"code":400,
"status":"error",
"message":"ptime is too old.",
"data":""
}

字段说明

字段 类型 说明
code int 返回码
status string 返回状态
message string 返回信息
data object 操作结果
exams object[] 问答列表
vid string 视频ID
examId string 问答ID
showTime int 问答出现的时间,单位:秒
qustion string 问答题目描述
choices array of string 问答选项json数组,每个题目最多5个选项
canSkip boolean 是否可跳过,默认值:false
explanationIfRight string 回答正确后的解答详情
showExplanationIfWrong string 回答答错误后是否显示解答详情
explanationIfWrong string 回答错误后的解答详情
backTime int 答错后回退到第几秒,-1代表不回退,默认为-1
status int 是否有效,1:有效,0:无效,默认为1
type int 题目类型,0:选择题,1:听力题(听力题即将下线
mp3url string 听力题的mp3音频文件url(听力题即将下线
illustration string 问答图片url

choices参数说明

示例
[
    {
        "index": 0,
        "content": "a",
        "isRight": true
    },
    {
        "index": 1,
        "content": "b",
        "isRight": false
    },
    {
        "index": 2,
        "content": "c",
        "isRight": false
    },
    {
        "index": 3,
        "content": "d",
        "isRight": true
    }
]
参数名 必选 类型及范围 说明
index int 选项序号,题目实际顺序为按此值的大小排序,不要重复
content string 选项内容
isRight boolean 所有选项中必须至少有一个设置为正确答案,否则接口返回错误。

java请求示例:

    public void testGetVideoExam() throws Exception {
        String url = "https://api.polyv.net/v2/video/get-video-exam";
        Map<String, String> params = new HashMap<>();
        params.put("userid", userid);
        params.put("vid", "a2dc4f25172872650e7d5c1b8026b13c_a");
        params.put("ptime", String.valueOf(System.currentTimeMillis()));
        params.put("sign", getSign(params, secretkey));
        String response = HttpClientUtil.getInstance().sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
        System.out.println(response);
    }
联系客服,在线咨询