1. 注册
Request:
method: POST
api/v1.0/users
{
mobile: "123",
password: "123",
sms_code: "123"
}
Response
成功:
{
"errno": "0",
"errmsg":"注册成功"
}
失败:
{
"errno": "4002", //状态码
"errmsg":"注册失败"
}
2.登陆
Request:
method: POST
api/v1.0/sessions
{
mobile: "133",
password: "itcast"
}
Response
成功:
{
"errno": "0",
"errmsg":"注册成功"
}
失败:
{
"errno": "4001", //状态码
"errmsg":"注册失败"
}
3.请求Session
Request:
method: GET
api/v1.0/session
no input data
Response
返回成功:
{
"errno": "0",
"errmsg":"OK",
"data": {"name" : "13313331333"}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态信息"
}
请求地域
Request:
method: GET
api/v1.0/areas
no input data
Response
返回成功:
{
"errno": 0,
"errmsg":"OK",
"data": [
{"aid": 1, "aname": "东城区"},
{"aid": 2, "aname": "西城区"},
{"aid": 3, "aname": "通州区"},
{"aid": 4, "aname": "顺义区"}]
//...
}
注册失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
5.请求用户基本信息
Request:
method: GET
api/v1.0/user
no input data
Response
返回成功:
{
"errno": "0",
"errmsg": "成功",
"data": {
"user_id": 1,
"name": "Aceld",
"password": "123123",
"mobile": "110",
"real_name": "刘丹冰",
"id_card": "210112244556677",
"avatar_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1n7It2ANn1dAADexS5wJKs808.png"
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
6.请求上传头像
Request:
method: POST
api/v1.0/user/avatar
图片的二进制数据
Response
返回成功:
{
"errno": "0",
"errmsg": "成功",
"data": {
"avatar_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1n6_L-AOB04AADexS5wJKs662.png"
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
7.请求更新用户名
Request:
method: PUT
api/v1.0/user/name
{
"name":"Aceld"
}
Response
返回成功:
{
"errno": "0",
"errmsg": "成功",
"data": {
"name": "Aceld"
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
8.实名认证检查
Request:
method: GET
api/v1.0/user/auth
no input data
Response
返回成功:
{
"errno": "0",
"errmsg": "成功",
"data": {
"user_id": 1,
"name": "Aceld",
"password": "123123",
"mobile": "110",
"real_name": "刘丹冰",
"id_card": "210112244556677",
"avatar_url": "http://101.200.170.171:9998/group1/M00/00/00/Zciqq1n7It2ANn1dAADexS5wJKs808.png"
}
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
9.更新实名认证信息
Request:
method: POST
api/v1.0/user/auth
{
real_name: "刘丹冰",
id_card: "21011223344556677"
}
Response
返回成功:
{
"errno": "0",
"errmsg": "成功"
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}
10.用户退出
Request:
method: DELETE
api/v1.0/session
no input data
Response
返回成功:
{
"errno": "0",
"errmsg": "成功"
}
失败:
{
"errno": "400x", //状态码
"errmsg":"状态错误信息"
}