The Users Resource

GET /users

Returns a list of all users. Non-admins will get an authorization error when trying to retrieve this resource.

Request

Header Parameters

authentication headers

Response

Body

{
    "userList": {
        "users": [
            {
                "id": 18,
                "version": 8,
                "createTime": "2016-08-10T16:50:18Z",
                "name": "admin5",
                "email": "admin5@example.com",
                "status": "ENABLED",
                "roles": [
                    {
                        "name": "admin"
                    }
                ]
            },
            {
                "id": 21,
                "version": 3,
                "createTime": "2016-06-02T21:19:07Z",
                "name": "user12",
                "email": "user12@example.com",
                "status": "ENABLED",
                "roles": []
            },
            {
                "id": 33,
                "version": 0,
                "createTime": "2016-06-02T21:17:54Z",
                "name": "admin7",
                "email": "admin7@example.com",
                "status": "DISABLED",
                "roles": [
                    {
                        "name": "admin"
                    }
                ]
            }
        ]
    }
}

POST /users

Creates a user.

Request

Body

{
    "userInfo": {
        "name": "new-user",
        "email": "new-user-email@example.com",
        "plaintextPassword": "newUserPassw0rd!"
    }
}

Response

Body

{
    "user": {
        "id": 13,
        "version": 0,
        "createTime": "2017-05-08T17:44:19Z",
        "name": "new-user",
        "email": "new-user-email@example.com",
        "status": "ENABLED",
        "roles": []
    }
}

GET /users/{userId}

Returns info about a user. A non-admin user can only retrieve his or her own info. Admins can retrieve any user's info.

Request

Path Parameters

userId
The desired user's id (not name).

Header Parameters

authentication headers

Response

Body

{
    "user": {
        "id": 21,
        "version": 3,
        "createTime": "2016-06-02T21:19:07Z",
        "name": "user12",
        "email": "user12@example.com",
        "status": "ENABLED",
        "roles": []
    }
}

PATCH /users/{userId}

Modify a user's info. A non-admin user can only modify his or her own info. Admins can modify any user's info. Attempts by non-admin user to change status or roles will be ignored.

Request

Path Parameters

userId
The desired user's id (not name).

Header Parameters

authentication headers

Optional:

If-Match
Only perform modification if server's user.version matches the value of this header.

Body

Response

Body

Page last modified on May 09, 2017, at 03:14 PM