Back to top

接口规范

方便设计API的文档规范. For the rules used as a reference when building this application, see The Rules of Go

upms

这是个例子用UMPS用户模块来说明通用接口规范如何定义

upms user

用户模块

user page

user page
GET/upms/user/page{?current,size,other}

用户分页

Example URI

GET http://localhost:3000/upms/user/page?current=&size=&other=
URI Parameters
HideShow
current
number (optional) Default: 1 

当前页

size
number (optional) Default: 20 

每页几条

other
number (optional) Default: <UserName> 

这里是搜索参数, 如 username 用户名搜索.

Response  200
HideShow
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 detail
GET/upms/user/{id}

用户详情

Example URI

GET http://localhost:3000/upms/user/90
URI Parameters
HideShow
id
int (required) Example: 90

用户ID

Response  200
HideShow
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 user
POST/upms/user/create

用户新增

Example URI

POST http://localhost:3000/upms/user/create
Request
HideShow
Headers
Content-Type: application/json
Body
{
    "username" : "zhangchao",
    "phone" : "17034642888",
    "roleIds" : [1, 2, 3],
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 0,
  "msg": "success",
  "data": true
}

update user

update user
POST/upms/user/update

用户更新

Example URI

POST http://localhost:3000/upms/user/update
Request
HideShow
Headers
Content-Type: application/json
Body
{
    "id": 1,
    "username" : "zhangchao",
    "phone" : "17034642888",
    "roleIds" : [1, 2, 3],
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 0,
  "msg": "success",
  "data": true
}

delete user batch

delete user batch
POST/upms/user/delete/batch

用户删除(批量与单个同存)

Example URI

POST http://localhost:3000/upms/user/delete/batch
Request
HideShow
Headers
Content-Type: application/json
Body
[
  1,
  2,
  3,
  4
]
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 0,
  "msg": "success",
  "data": true
}

goms

组织模块

goms upms

用户组织模块

user apply

user apply
POST/goms/apply

用户申请加入组织,加入组织理由可选放在request body

Example URI

POST http://localhost:3000/goms/apply
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "uid": 1,
  "oid": 2,
  "content": "我申请加入的理由"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 0,
  "msg": "success",
  "data": true
}

user pass batch

user pass batch
POST/goms/review/pass/batch

组织通过(批量与单个同存),可选通过的理由放在request body

Example URI

POST http://localhost:3000/goms/review/pass/batch
Request
HideShow
Headers
Content-Type: application/json
Body
{
    "ids": [1, 2, 3],
    "status": 3, // 用来变更状态
    "content" : "通过的理由"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 0,
  "msg": "success",
  "data": true
}

Generated by aglio on 28 Feb 2019