接口规范
方便设计API的文档规范. For the rules used as a reference when building this application, see The Rules of Go
upms ¶
这是个例子用UMPS用户模块来说明通用接口规范如何定义
upms user
用户模块
user page ¶
user pageGET/upms/user/page{?current,size,other}
用户分页
Example URI
GET http://localhost:3000/upms/user/page?current=&size=&other=
URI Parameters
- current
number
(optional) Default: 1当前页
- size
number
(optional) Default: 20每页几条
- other
number
(optional) Default: <UserName>这里是搜索参数, 如
username
用户名搜索.
Response
200
Headers
Content-Type: application/json
Body
{
"code": 0,
"msg": "success",
"data": {
"records": [
{
"id": 1,
"username": "admin",
"createTime": "2018-04-20 07:15:18",
"updateTime": "2019-01-05 17:11:20",
"phone": "17034642888",
"roleList": [
{
"id": 1,
"name": "管理员",
"code": "ROLE_ADMIN",
"desc": "管理员",
"type": 2,
"scope": "2",
"createTime": "2017-10-29 15:45:51",
"updateTime": "2018-12-26 14:09:11"
}
]
}
],
"total": 1,
"size": 20,
"current": 1,
"searchCount": true,
"pages": 1
}
}
user detail ¶
user detailGET/upms/user/{id}
用户详情
Example URI
GET http://localhost:3000/upms/user/90
URI Parameters
- id
int
(required) Example: 90用户ID
Response
200
Headers
Content-Type: application/json
Body
{
"code": 0,
"msg": "success",
"data": {
"id": 1,
"username": "admin",
"createTime": "2018-04-20 07:15:18",
"updateTime": "2019-01-05 17:11:20",
"phone": "17034642888",
"roleList": [
{
"id": 1,
"name": "管理员",
"code": "ROLE_ADMIN",
"desc": "管理员",
"type": 2,
"scope": "2",
"createTime": "2017-10-29 15:45:51",
"updateTime": "2018-12-26 14:09:11"
}
]
}
}
create user ¶
create userPOST/upms/user/create
用户新增
Example URI
POST http://localhost:3000/upms/user/create
Request
Headers
Content-Type: application/json
Body
{
"username" : "zhangchao",
"phone" : "17034642888",
"roleIds" : [1, 2, 3],
}
Response
200
Headers
Content-Type: application/json
Body
{
"code": 0,
"msg": "success",
"data": true
}
update user ¶
update userPOST/upms/user/update
用户更新
Example URI
POST http://localhost:3000/upms/user/update
Request
Headers
Content-Type: application/json
Body
{
"id": 1,
"username" : "zhangchao",
"phone" : "17034642888",
"roleIds" : [1, 2, 3],
}
Response
200
Headers
Content-Type: application/json
Body
{
"code": 0,
"msg": "success",
"data": true
}
goms ¶
组织模块
goms upms
用户组织模块
user apply ¶
user applyPOST/goms/apply
用户申请加入组织,加入组织理由可选放在request body
里
Example URI
POST http://localhost:3000/goms/apply
Request
Headers
Content-Type: application/json
Body
{
"uid": 1,
"oid": 2,
"content": "我申请加入的理由"
}
Response
200
Headers
Content-Type: application/json
Body
{
"code": 0,
"msg": "success",
"data": true
}
user pass batch ¶
user pass batchPOST/goms/review/pass/batch
组织通过(批量与单个同存),可选通过的理由放在request body
里
Example URI
POST http://localhost:3000/goms/review/pass/batch
Request
Headers
Content-Type: application/json
Body
{
"ids": [1, 2, 3],
"status": 3, // 用来变更状态
"content" : "通过的理由"
}
Response
200
Headers
Content-Type: application/json
Body
{
"code": 0,
"msg": "success",
"data": true
}