Skip to content
Siyuan Zhang | 张豆 edited this page Oct 11, 2019 · 1 revision

Get Users

Http Request

GET /api/v1/users

URL Parameters

Parameter Default Description
page 0
size 10

Query Parameters

Parameter Default Description
username null Fuzzy query.
id null
name null Fuzzy query.
studentNumber null
temporary null
school null

Example

GET /api/v1/users?username=kast&page=0&size=5

Response

{
    "currentPage": 0,
    "currentSize": 5,
    "total": 1,
    "list": [
        {
            "id": 20,
            "username": "kastnerorz",
            "firstname": null,
            "lastname": null,
            "email": "[email protected]",
            "school": "上海大学",
            "signature": null,
            "acCount": 111,
            "submitCount": 5,
            "acRate": 0,
            "enabled": true,
            "authorities": [
                {
                    "authority": "ROLE_ADMIN"
                }
            ]
        }
    ]
}

Get One User

Http Request

GET /api/v1/users/:id

Response

{
    "id": 20,
    "username": "kastnerorz",
    "firstname": null,
    "lastname": null,
    "email": "[email protected]",
    "school": "上海大学",
    "signature": null,
    "acCount": 111,
    "submitCount": 5,
    "acRate": 0,
    "enabled": true,
    "authorities": [
        {
            "authority": "ROLE_ADMIN"
        }
    ]
}

Create User

Http Request

POST /api/v1/users

Request Body

Key Type Default Need
username String Yes
password String Yes
studentNumber String
name String
email String Yes
school String Yes
signature String
enabled Boolean true
authorities Array ROLE_USER

Example

POST /api/v1/users

Request Body:
{
    "username": "test",
    "password": "pass",
    "email": "[email protected]",
    "school": "上海大学",
    "signature": [
        {
            "name": "ROLE_USER"
        },
        {
            "name": "ROLE_ADMIN"
        }
    ]
}

Response

{
    "id": 20,
    "username": "kastnerorz",
    "firstname": null,
    "lastname": null,
    "email": "[email protected]",
    "school": "上海大学",
    "signature": null,
    "acCount": 111,
    "submitCount": 5,
    "acRate": 0,
    "enabled": true,
    "authorities": [
        {
            "authority": "ROLE_ADMIN"
        }
    ]
}

Delete Users

Http Request

DELETE /api/v1/users

Request Body

Key Type Default Need
list Array Yes

Example

DELETE /api/v1/users

Request Body:
{
    "list": [12, 23, 56]
}

Response

[
    {
        "id": 20,
        "username": "kastnerorz",
        "firstname": null,
        "lastname": null,
        "email": "[email protected]",
        "school": "上海大学",
        "signature": null,
        "acCount": 111,
        "submitCount": 5,
        "acRate": 0,
        "enabled": true,
        "authorities": [
            {
                "authority": "ROLE_ADMIN"
            }
        ]
    }
]