保利威文档中心

幫助中心

取得單一影片的問答題目

更新時間: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);
    }
联系客服,在线咨询