介绍
包括验证码ctoken获取,验证码ctoken-结果对保存,以及验证码结果校验三个功能,分别对应了SOA接口(com.lcb.soa.captcha.service.ICaptchaService)和 HTTP API+JSON 接口(com.lcb.soa.captcha.controller.ICaptchaAdminController)。SOA接口调用直接代码引用。下面是HTTP API接口的具体调用地址和对应契约(in JSON)。
验证码令牌获取接口:ICaptchaAdminController.getToken
- HTTP API 暴露地址:http://serverhost:10006/text_captcha_admin/getToken
- 请求契约:
{
"appCode":"100"
} - 返回契约:
{
"costTime": 34,
"msg": "ok",
"result": {
"error": null,
"success": true,
"token": "ZNHhGpumtiskiItmSGqe"
},
"statusCode": "200",
"validationErrors": null
}
说明:获取验证码令牌的时候,无需传参数(必要字段除外)。
验证码令牌和结果保存接口:ICaptchaAdminController.save
- HTTP API 暴露地址:http://serverhost:10006/text_captcha_admin/save
- 请求契约:
{
"appCode":"1901",
"captchaToken":"asdfkasdssss",
"captchaResult":"Gx3u"
} - 响应契约:
{
"costTime":299,
"msg":"ok",
"result":
{
"error":null,
"success":true
},
"statusCode":"200",
"validationErrors":null
}
验证码结果校验
- HTTP API 暴露地址:http://serverhost:10006/text_captcha_admin/validate
- 请求契约:
{
"appCode":100,
"captchaResult":"K7RM",
"captchaToken":"asdfkasdssss"
} - 响应契约:
{
"costTime": 54,
"msg": "ok",
"result": {
"error": null,
"pass": false,
"success": true
},
"statusCode": "200",
"validationErrors": null
}
网友评论