1、通过视频id创建视频的问答题目
2、接口支持https协议
http://api.polyv.net/v2/video/save-video-exam
http://api.polyv.net/v2/video/save-video-exam
vid=1b448be3231ebf0005ec631a7e4247ee_1&question=%E6%B5%8B%E8%AF%95%E5%88%9B%E5%BB%BA%E9%97%AE%E7%AD%94%E9%A2%98%E7%9B%AE%EF%BC%9F&showTime=2&sign=27D7F36E628DE0E616DBE3C48A1AECEA090C2FCF&explanationIfRight=%E7%AD%94%E5%AF%B9%E5%95%A6&canSkip=false&choices=%5B%7B%22index%22%3A0%2C%22content%22%3A%22a%22%2C%22isRight%22%3Atrue%7D%2C%7B%22index%22%3A2%2C%22content%22%3A%22b%22%2C%22isRight%22%3Afalse%7D%2C%7B%22index%22%3A3%2C%22content%22%3A%22c%22%2C%22isRight%22%3Afalse%7D%5D&userid=1b448be323&ptime=1620286349810&explanationIfWrong=%E7%AD%94%E9%94%99%E4%BA%86&backTime=1
强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(VodVideoManageManagementTest.class);
/**
* 创建问答题目
*/
@Test
public void testAddQuiz() 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/save-video-exam";
String vid = "1b448be3231ebf0005ec631a7e4247ee_1";
String showTime = "2";
String question = "测试创建问答题目?";
String choices = "[{\"index\":0,\"content\":\"a\",\"isRight\":true},{\"index\":2,\"content\":\"b\",\"isRight\":false},{\"index\":3,\"content\":\"c\",\"isRight\":false}]";
String explanationIfRight = "答对啦";
String explanationIfWrong = "答错了";
String canSkip = "false";
String backTime = "1";
//调用参数
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userId);
requestMap.put("ptime", ptime);
requestMap.put("showTime", showTime);
requestMap.put("vid", vid);
requestMap.put("explanationIfRight", explanationIfRight);
requestMap.put("question", question);
requestMap.put("explanationIfWrong", explanationIfWrong);
requestMap.put("canSkip", canSkip);
requestMap.put("backTime", backTime);
requestMap.put("choices", choices);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFormBody(url,requestMap);
log.debug("测试创建问答题目,{}", response);
//do somethings
}
{
"code":200,
"status":"success",
"message":"success",
"data":{
"examId":"1794097a449"
}
}
{
"code":400,
"status":"error",
"message":"the sign is not right",
"data":""
}
{
"code":400,
"status":"error",
"message":"ptime is too old.",
"data":""
}
{
"code": 400,
"status": "error",
"message": "video could not find by vid",
"data": ""
}