美文网首页
测验接口

测验接口

作者: 宝宝爱樱花 | 来源:发表于2018-09-06 00:04 被阅读0次

接口约定

  • 使用https
  • restful风格
  • 用户端: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}
  • 测试环境域名babieta.xivan.cn
  • 正式环境域名待定
  • 公共参数放在header,如userid,session_key,unionid,version等
  • resource: exams

接口


GET /exams/{exams_id}/categories/{categories_id}/questions/{questions_id}

name cname type Description
用途 获取测试题
方式 GET
版本号 v1.0
exams_id first(首次测验)/upgrade(解锁升级测验)
categories_id pronunciation(发音测试)/fluency(流利度测试)/express(表达测试)
questions_id 可选,目前没用
请求数据:

query_string 参数/可选参数

name cname type Description
limit 数目 int 获取数量,默认10
subject 数目 string 话题列表,简单形式(话题名:数量), 如subject=节日:1, 活动:1

curl -i "https://babieta.xivan.cn/api/v1.0/exams/first/categories/pronunciation/questions?limit=4&subject=节日:1, 活动:1" -H "userid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e"
wx.request({
      "url":"https://babieta.xivan.cn/api/v1.0/exams/first/categories/pronunciation/questions", 
      "method":"GET",
      "success": res =>{
        console.log(res)
      },
      "data":{limit:'4'},
      "dataType":"json", 
      "header": { "content-type":"application/x-www-form-urlencoded",
        "userid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息
list array<object> 测试题列表

object

name cname type Description
desc string 描述
title string 标题
id string 题目id


发音

{
    "msg": "",
    "code": 0,
    "list": [{"desc":"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.", "title":"", "id":2}]
}

流利度

{
    "msg": "",
    "code": 0,
    "list": [{"desc":"描述一个", "title":"APP", "id":4}, ...]
}

表达

{
    "msg": "",
    "code": 0,
    "list": [{"desc":"Why do some people like gambling at football, such as the World Cup?", "title":"科技", "id":65}]
}

POST /exams/{exams_id}/categories/{categories_id}/questions/{questions_id}/report_result

name cname type Description
用途 上报发音测试、流利度测试、表达测试等测试题识别结果
方式 POST
版本号 v1.0
exams_id first(首次测验)/upgrade(解锁升级测验)
categories_id pronunciation(发音测试)/fluency(流利度测试)/express(表达测试)
action report_result
请求数据:

body 参数/可选参数

name cname type Description
original_text 原文本 string
translate_text 用户语音 string
level 用户级别 int
index 阶段索引 int

curl -XPOST https://babieta.xivan.cn/v1.0/exams/first/categories/pronunciation/questions/123/report_result    -d '{"original_text":"abc", "translate_text":"xxx", "level":0}' -H "userid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e"
wx.request({
      "url":"https://babieta.xivan.cn/v1.0/exams/first/categories/pronunciation/questions/123/report_result", 
      "method":"POST",
      "success": res =>{
        console.log(res)
      },
      "data":{original_text:"abc", translate_text:"xxx"},
      "dataType":"json", 
      "header": { "content-type":"application/json",
        "userid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息

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

GET /exams/{exams_id}/scores

name cname type Description
用途 获取首测三个测验结果和总成绩
版本号 v1.0
exams_id first(首次测验)/upgrade(解锁升级测验)
level 用户级别 int

curl -XGET https://babieta.xivan.cn/v1.0/exams/first/score?level=5 -H "userid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e" 
wx.request({
      "url":"https://babieta.xivan.cn/v1.0/first_test/score", 
      "method":"GET",
      "success": res =>{
        console.log(res)
      },
      "data":{level:3},
      "dataType":"json", 
      "header": { "content-type":"application/json",
        "userid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息
pronunciation_score int 发音岁数
fluency_score int 流利度岁数
express_score int 表达岁数
integrated_score int 综合岁数

{
    "code":0,
    "msg":"",
    "pronunciation_score":9,
    "fluency_score":8,
    "express_score":7,
    "integrated_score":8
}

POST /exams/{exams_id}/payment

name cname type Description
用途 当前等级测验支付
方式 POST
版本号 v1.0
exams_id upgrade(解锁升级测验)

curl -XPOST https://babieta.xivan.cn/v1.0/exams/upgrade/payment   -H "userid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e"
wx.request({
      "url":"https://babieta.xivan.cn/v1.0/exams/upgrade/payment", 
      "method":"POST",
      "success": res =>{
        console.log(res)
      },
      "data":{"level":3},
      "dataType":"json", 
      "header": { "content-type":"application/json",
        "userid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息

POST /exams/{exams_id}/retry

name cname type Description
用途 重新开始当前测验
方式 POST
版本号 v1.0
exams_id upgrade(解锁升级测验) first(首测)
请求数据:

body 参数/可选参数

name cname type Description
level 用户级别 int

curl -XPOST https://babieta.xivan.cn/v1.0/exams/upgrade/retry-H "userid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e" -d '{"level":3}'
wx.request({
      "url":"https://babieta.xivan.cn/v1.0/exams/upgrade/retry", 
      "method":"POST",
      "success": res =>{
        console.log(res)
      },
      "data":{level:3},
      "dataType":"json", 
      "header": { "content-type":"application/json",
        "userid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息

GET /exams/last_score

name cname type Description
用途 获取首测三个测验结果和总成绩
版本号 v1.0

curl -XGET https://babieta.xivan.cn/v1.0/exams/last_score -H "userid:oslC94mGqAAEz6iWhKhL9dEY5l3o" -H "token:25e8ba0469c6f1c0c6dcd4fe952b8e4e" 
wx.request({
      "url":"https://babieta.xivan.cn/v1.0/exams/last_score", 
      "method":"GET",
      "success": res =>{
        console.log(res)
      },
      "data":{level:3},
      "dataType":"json", 
      "header": { "content-type":"application/json",
        "userid": "oslC94mGqAAEz6iWhKhL9dEY5l3o", "token":"25e8ba0469c6f1c0c6dcd4fe952b8e4e"},
      "complete": res => {
        console.log(res)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息
pronunciation_score int 发音岁数
fluency_score int 流利度岁数
express_score int 表达岁数
integrated_score int 综合岁数
exam_id string first:首测,upgrade:自测

{
    "code":0,
    "msg":"",
    "pronunciation_score":9,
    "fluency_score":8,
    "express_score":7,
    "integrated_score":8,
    "exam_id":"first"
}

相关文章

  • 测验接口

    接口约定 使用httpsrestful风格用户端:https://{域名}/api/{接口版本号}/{resour...

  • 测验:函数式接口

    下面哪些接口是函数式接口? 答案:只有Adder是函数式接口。SmartAdder不是函数式接口,因为它定义了两个...

  • 接口索引

    首测接口协议 (废弃) 登录 用户信息 测验接口协议(首测、升级解锁) 三项修习 积分 三项修习管理端 评论 点...

  • 2018-08-13Lambda表达式

    简洁地表示可传递的匿名函数的一种方式 测验3.1:Lambda语法 函数式接口 就是只定义一个抽象方法的接口。 方...

  • 《人格谜题》第五章 人格评估1(一)人格测验及其结果

    本章主要讲了人格评估的本质、测验行业、人格测验(S型数据人格测验与B型数据人格测验、投射测验、客观性测验) 客观性...

  • 测验

    我们每训练一周,就要测验一次。大班的每次测验每次都涨成绩,测验的时候,教练在上边计时,在上面走,一边走一边摇着秒表...

  • 测验

    1.消息中心2.0的特性: 消息持久化,通过可靠组播实现集群, 订阅通过会话机制保证可靠的推送,发布端通过应答机制...

  • 测验

    大周二的的早晨,6点多就起来,还以为要出早操,结果屁都没有放一个, 说不出了,昨天就嚷嚷着,真是让人很无语。 不光...

  • 测验

    噗咚 沉没在水面下的沙粒 曾激起最不起眼的浪花 哗啦 接着落下更多的沙粒 它们耀眼如金,落水而亡 哎呦 有人可惜,...

  • 测验

    要测验的试卷,提前发给学生!

网友评论

      本文标题:测验接口

      本文链接:https://www.haomeiwen.com/subject/ysftgftx.html