首測接口協(xié)議

接口約定

  • 使用https
  • restful風(fēng)格
  • 用戶端:https://{域名}/api/{接口版本號}/{resource}/{resource_id}/{sub_resource}/{sub_resource_id}/{action}?{query_string}
  • 管理端:https://{域名}/admin/api/{接口版本號}/{resource}/{resource_id}/{sub_resource}/{sub_resource_id}/{action}?{query_string}
  • 測試環(huán)境域名babieta.xivan.cn
  • 正式環(huán)境域名待定
  • 公共參數(shù)放在header,如userid,session_key,unionid,version等
  • resource: first_test

接口


獲取測試題列表

name cname type Description
用途 獲取發(fā)音測試、流利度測試、表達(dá)測試等測試題
方式 GET
版本號 v1.0
sub_resource tests
sub_resource_id pronunciation(發(fā)音測試)/fluency(流利度測試)/express(表達(dá)測試)
請求數(shù)據(jù):

query_string 參數(shù)

name cname type Description
limit 數(shù)目 int 獲取數(shù)量

curl -i "https://babieta.xivan.cn/api/v1.0/first_test/tests/pronunciation?limit=4" -H "openid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e"
wx.request({
      "url":"https://babieta.xivan.cn/api/v1.0/first_test/tests/pronunciation", 
      "method":"GET",
      "success": res =>{
        console.log(res)
      },
      "data":{limit:'4'},
      "dataType":"json", 
      "header": { "content-type":"application/x-www-form-urlencoded",
        "openid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回數(shù)據(jù):
name cname type Description
code int 返回碼 0成功 非0失敗
msg string 錯誤信息
list array<string> 測試題列表

{"msg": "", "code": 0, "list": ["Americans called her the \"Queen of Soul,\" and U.S. music industry magazine Billboard2, which maintains charts of popular American songs, lists Franklin as the second-most charted female artist in the chart's 59-year history."]}

上報測試結(jié)果

name cname type Description
用途 上報發(fā)音測試、流利度測試、表達(dá)測試等測試題識別結(jié)果
方式 POST
版本號 v1.0
sub_resource tests
sub_resource_id pronunciation(發(fā)音測試)/fluency(流利度測試)/express(表達(dá)測試)
action report_result

curl -XPOST https://babieta.xivan.cn/v1.0/first_test/tests/pronunciation/report_result    -d '{"original_text":"abc", "translate_text":"xxx"}' -H "openid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e"
wx.request({
      "url":"https://babieta.xivan.cn/api/v1.0/first_test/tests/pronunciation/report_result", 
      "method":"POST",
      "success": res =>{
        console.log(res)
      },
      "data":{original_text:"abc", translate_text:"xxx"},
      "dataType":"json", 
      "header": { "content-type":"application/json",
        "openid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回數(shù)據(jù):
name cname type Description
code int 返回碼 0成功 非0失敗
msg string 錯誤信息

{
    "code":0,
    "msg":""
}

獲取成績

name cname type Description
用途 獲取首測三個測驗結(jié)果和總成績
方式 GET
版本號 v1.0
sub_resource score

curl -XGET https://babieta.xivan.cn/v1.0/first_test/score -H "openid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e"
wx.request({
      "url":"https://babieta.xivan.cn/v1.0/first_test/score", 
      "method":"GET",
      "success": res =>{
        console.log(res)
      },
      "data":{},
      "dataType":"json", 
      "header": { "content-type":"application/json",
        "openid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })

pronunciation_tests(發(fā)音測試)/fluency_tests(流利度測試)/express_tests(表達(dá)測試)

返回數(shù)據(jù):
name cname type Description
code int 返回碼 0成功 非0失敗
msg string 錯誤信息
pronunciation_score int 發(fā)音歲數(shù)
fluency_score int 流利度歲數(shù)
express_score int 表達(dá)歲數(shù)
integrated_score int 綜合歲數(shù)

{
    "code":0,
    "msg":"",
    "pronunciation_score":9,
    "fluency_score":8,
    "express_score":7,
    "integrated_score":8
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容