Flask-API接口文档

目录

  1. 获取城市接口

  2. 注册接口


1. 获取城市接口

接口功能

获取所有城市数据

URL

http://127.0.0.1:5000/city/

支持格式

JSON

HTTP请求方式

GET

请求参数

返回字段
返回字段 字段类型 说明
returnCode string 返回结果状态。0:正常;-1:错误。
returnValue object 所有城市数据
接口示例

地址:http://127.0.0.1:5000/city/

{
"returnCode": "0",
"returnValue": {
"A": [
{
"id": 333,
"parentId": 0,
"regionName": "深圳",
"cityCode": 45454,
"pinYin": "Shenzhen"
},
...
],
"B": [
...
]
}
}

2. 注册接口

接口功能

用户注册

URL

http://127.0.0.1:5000/register/

支持格式

JSON

HTTP请求方式

POST

请求参数
参数名 是否必须 类型 说明
username True string 用户名
password True string 密码
email True string 邮箱
返回字段
返回字段 字段类型 说明
returnCode string 返回结果状态。0:正常;-1:错误,。
returnValue object 返回的用户数据
msg string 状态说明
接口示例

地址:http://127.0.0.1:5000/register/

{
"returnValue": {
"username": "lisi3",
"is_active": false,
"utoken": "64c57c33-ab0f-4093-a4ea-21c82e18b90b",
"email": "[email protected]"
},
"returnCode": "0",
"msg": "success"
}

3. 登录接口

接口功能

用户登录

URL

http://127.0.0.1:5000/login/

支持格式

JSON

HTTP请求方式

POST

请求参数
参数名 是否必须 类型 说明
username True string 用户名
password True string 密码
返回字段
返回字段 字段类型 说明
returnCode string 返回结果状态。0:正常;-1:用户未激活, -2:密码错误, -3:用户不存在。
returnValue object 用户数据
msg string 状态说明
接口示例

地址:http://127.0.0.1:5000/login/

{
"returnCode": "0",
"msg": "success",
"returnValue": {
"utoken": "956927d1-3ecd-44d7-aecc-2f9bf4e9835d",
"is_active": true,
"email": "[email protected]",
"name": "wangwu"
}
}

你可能感兴趣的:(Flask-API接口文档)