新增和修改视频问答
更新时间:2022-05-23 19:02:59
接口URL
https://api.polyv.net/v2/video/save-video-exam
接口说明
新增和修改问答
支持格式
JSON
请求方式
POST
请求参数
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
}
]
返回正确结果JSON示例
{
"code": 200,
"status": "success",
"message": "success",
"data": {
"examId": "179228dfe4f"
}
}
返回错误结果JSON示例
签名不正确
{
"code":400,
"status":"error",
"message":"the sign is not right",
"data":""
}
时间戳过期
{
"code":400,
"status":"error",
"message":"ptime is too old.",
"data":""
}
vid 不存在
{
"code": 400,
"status": "error",
"message": "video could not find by vid",
"data": ""
}
字段说明
java请求示例:
public void testSaveVideoExam() throws Exception {
String url = "https://api.polyv.net/v2/video/save-video-exam";
Map<String, String> params = new HashMap<>();
params.put("userid", userid);
params.put("vid", "a2dc4f25172872650e7d5c1b8026b13c_a");
params.put("examId", "179228dfe4f");
params.put("question", "测试问题");
params.put("showTime", "12");
params.put("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}]");
params.put("canSkip", "false");
params.put("explanationIfRight", "回答正确后的解答详情");
params.put("showExplanationIfWrong", "true");
params.put("explanationIfWrong", "回答错误后的解答详情");
params.put("backTime", "1");
params.put("ptime", String.valueOf(System.currentTimeMillis()));
params.put("sign", getSign(params, secretkey));
String response = HttpClientUtil.getInstance().sendHttpPost(url, params);
System.out.println(response);
}