Required attributes:
login
/id
(string) : login of the useruserName
(text) : Full name of the userroles
(multi-userRole) : Array containing roles of the user (read
,write
oradmin
)status
(userStatus) :Ok
orLocked
default=Okpreference
(string) : JSON object containing user preference default={}
Optional attributes:
avatar
(string) : avatar of user. It is an image encoded in base 64password
(string) : user password if local authentication is used
Attributes generated by the backend:
key
(uuid) : API key to authenticate this user (deprecated)
HTTP Method | URI | Action |
---|---|---|
GET | /api/logout | Logout |
POST | /api/login | User login |
GET | /api/user/current | Get current user |
POST | /api/user/_search | Find user |
POST | /api/user | Create a user |
GET | /api/user/:userId | Get a user |
DELETE | /api/user/:userId | Delete a user |
PATCH | /api/user/:userId | Update user details |
POST | /api/user/:userId/password/set | Set password |
POST | /api/user/:userId/password/change | Change password |
with-key
(boolean)
A user can be created using the following URL:
POST /api/user
Required case attributes (cf. models) must be provided.
This call returns attributes of the created user.
This call is authenticated and requires admin role.
Creation of a user:
curl -XPOST -H 'Authorization: Bearer ***API*KEY***' -H 'Content-Type: application/json' http://127.0.0.1:9000/api/user -d '{
"login": "georges",
"name": "Georges Abitbol",
"roles": ["read", "write"],
"password": "La classe"
}'
It returns:
{
"createdBy": "myuser",
"name":"Georges Abitbol",
"roles": ["read", "write" ],
"_id": "georges",
"user": "myuser",
"createdAt": 1496561862924,
"status": "Ok",
"id": "georges",
"_type": "user",
"has-key":false
}
If external authentication is used (LDAP or AD) password field must not be provided.