美文网首页
首测接口协议

首测接口协议

作者: 宝宝爱樱花 | 来源:发表于2018-08-14 23:11 被阅读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: first_test

接口


获取测试题列表

name cname type Description
用途 获取发音测试、流利度测试、表达测试等测试题
方式 GET
版本号 v1.0
sub_resource tests
sub_resource_id pronunciation(发音测试)/fluency(流利度测试)/express(表达测试)
请求数据:

query_string 参数

name cname type Description
limit 数目 int 获取数量

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)
      }
    })
返回数据:
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."]}

上报测试结果

name cname type Description
用途 上报发音测试、流利度测试、表达测试等测试题识别结果
方式 POST
版本号 v1.0
sub_resource tests
sub_resource_id pronunciation(发音测试)/fluency(流利度测试)/express(表达测试)
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)
      }
    })
返回数据:
name cname type Description
code int 返回码 0成功 非0失败
msg string 错误信息

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

获取成绩

name cname type Description
用途 获取首测三个测验结果和总成绩
方式 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(发音测试)/fluency_tests(流利度测试)/express_tests(表达测试)

返回数据:
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
}

相关文章

  • 接口索引

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

  • 首测接口协议

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

  • 接口测试 进阶三讲

    WebSocket接口:如何测试一个完全陌生的协议接口? 未知的新协议接口并不可怕 那在面对一个陌生的新协议时,测...

  • 服务器压力测试小记

    Jmeter压测: Http接口测试 protoBuffer+Netty自定义协议接口测试(BeanShell) ...

  • 基于postman进行接口测试实战

    一:接口测试前准备 接口测试是基于协议的功能黑盒测试,在进行接口测试之前,我们要了解接口的信息,然后才知道怎么来测...

  • Ant+Jmeter自动化接口测试

    背景 最近在看Jmeter和接口测试,发现了几个问题,基于HTTP协议的接口测试实施起来很简单,但是怎么实施接口测...

  • 编写一个接口压测工具

    前言 前段时间有个项目即将上线,需要对其中的核心接口进行压测;由于我们的接口是 gRPC 协议,找了一圈发现压测工...

  • 接口测试详细流程(附图)

    一、测试流程 1. 确定待测接口范围 总共要测多少接口、如何交互待测接口统计渠道:接口文档、代码分析、线上log、...

  • 学生整理,最全软件测试面试问题总结!

    接口测试 一、平常用什么工具测接口的?接口测试工具很多,主要postman 二、没有接口文档,如果做接口测?(这是...

  • 接口功能测试的重点,理解接口,你就理解功能测试

    接口功能测试 接口功能测试: 1.接口测试类型 目前主流的有webservice接口(soap协议、rest协议的...

网友评论

      本文标题:首测接口协议

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