Skip to content

RESTful API For User

Echo edited this page Mar 19, 2018 · 13 revisions
获取指定用户信息
Request
GET /saltshaker/api/v1.0/user/u-3d48618a283111e8a7e3000c298454d8

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "user": {
        "id": "u-3d48618a283111e8a7e3000c298454d8",
        "acl": [
            "a-977a2b3a2b2d11e886cb000c298454d8"
        ],
        "role": [
            "r-4f24769c28c611e8a7e3000c298454d8"
        ],
        "groups": [
            "g-60e2f3f22b1b11e886cb000c298454d8",
            "g-60e2f3f22b1b11e886cb000c298454d8"
        ],
        "product": [
            "p-bbfc8b5221d611e894b0000c298454d8"
        ],
        "username": "salt"
    }
}
获取用户列表
Request
GET /saltshaker/api/v1.0/user

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "users": {
        "user": [
            {
                "id": "u-3d48618a283111e8a7e3000c298454d8",
                "acl": [
                    "a-977a2b3a2b2d11e886cb000c298454d8"
                ],
                "role": [
                    "r-4f24769c28c611e8a7e3000c298454d8"
                ],
                "groups": [
                    "g-60e2f3f22b1b11e886cb000c298454d8",
                    "g-60e2f3f22b1b11e886cb000c298454d8"
                ],
                "product": [
                    "p-bbfc8b5221d611e894b0000c298454d8"
                ],
                "username": "salt"
            },
            {
                "id": "u-d5cce6862b3f11e886cb000c298454d8",
                "acl": [
                    "a-977a2b3a2b2d11e886cb000c298454d8"
                ],
                "role": [
                    "r-4f24769c28c611e8a7e3000c298454d8",
                    "r-hf24769c28c611e8a7e3000c298454d8"
                ],
                "groups": [
                    "g-60e2f3f22b1b11e886cb000c298454d8",
                    "g-60e2f3f22b1b11e886cb000c298454d8"
                ],
                "product": [
                    "p-bbfc8b5221d611e894b0000c298454d8"
                ],
                "username": "admin"
            }
        ]
    }
}
添加用户
Request
POST /saltshaker/api/v1.0/role

POST Body
{
	"username": "salt1",
	"password": "salt"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": true,
    "message": ""
}
删除用户
Request
DELETE /saltshaker/api/v1.0/user/u-b0175be62b1d11e886cb000c298454d8

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": true,
    "message": ""
}
修改用户
Request
PUT /saltshaker/api/v1.0/user/u-feef9dfc28e611e8a7e3000c298454d8

PUT Body
{
	"username": "salt1",
	"password": "salt"
}
Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "status": true,
    "message": ""
}

Clone this wiki locally