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

delete user
POST/upms/user/delete/{id}

用户删除

Example URI

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

The id of the user.

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
{
  "ids": [
    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/{uid}/apply/{oid}

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

Example URI

POST http://localhost:3000/goms/90/apply/90
URI Parameters
HideShow
uid
int (required) Example: 90

申请的用户的ID

oid
int (required) Example: 90

被申请的组织的ID

Request
HideShow
Headers
Content-Type: application/json
Body
{
  "desc": "我申请加入的理由"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 0,
  "msg": "success",
  "data": true
}

user apply

user apply
POST/goms/review/{uid}

组织通过与驳回请求,驳回的理由放在request body

Example URI

POST http://localhost:3000/goms/review/90
URI Parameters
HideShow
uid
int (required) Example: 90

申请的用户的ID

Request
HideShow
Headers
Content-Type: application/json
Body
{
    "isPass": true // true 通过, false 驳回
    "desc" : "驳回的理由"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 0,
  "msg": "success",
  "data": true
}

user apply batch

user apply batch
POST/goms/review/batch

组织批量通过与驳回请求,ids, 是否通过, 驳回的理由放在request body里,

Example URI

POST http://localhost:3000/goms/review/batch
Request
HideShow
Headers
Content-Type: application/json
Body
{
    "ids": [1, 2, 3],
    "isPass": true, // true 通过, false 驳回
    "desc" : "驳回的理由"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "code": 0,
  "msg": "success",
  "data": true
}

Generated by aglio on 28 Feb 2019