Create and edit user account
Circularo REST API example
Creates new user account and adds him into a group. Then suspends and then re-actives the account.
Step 1 - Sign administrator in
Sign administrator user in.
Endpoint
POST - /login
Example
/login
Content-Type: application/json
{
"name": "john.doe@circularo.com",
"password": "!123.my_strongPASSWORD!",
"tenant": "default"
}
Response
Note following properties in response object:
- token - In response object at position ‘token‘. It may have value of “sOhWtNzU6TpUgV0WONr5YLtBClcbbB8xKv9jnUe5zaOLC7ueyepoyTtuNckXZStI“.
Step 2 - Create new active user
Creates a new user account. This user account is immediately active and can perform actions.
Endpoint
POST - /users
Example
/users?token=sOhWtNzU6TpUgV0WONr5YLtBClcbbB8xKv9jnUe5zaOLC7ueyepoyTtuNckXZStI
Content-Type: application/json
{
"sendMail": true,
"users": [
{
"fullname": "Derek Edward Trotter",
"mail": "derek.trotter@circularo.com",
"name": "derek.trotter@circularo.com",
"password": "#del.boy!",
"configuration": {
"language": "en"
},
"group": [
"everyone"
],
"role": "Market trader",
"status": "active"
}
]
}
Step 3 - Replace user group
Replaces the user group. The user will be removed from the original group and moved to the new one.
Endpoint
PUT - /users/:id
Example
/users/derek.trotter@circularo.com?token=sOhWtNzU6TpUgV0WONr5YLtBClcbbB8xKv9jnUe5zaOLC7ueyepoyTtuNckXZStI
Content-Type: application/json
{
"group": [
"traders"
]
}
Step 4 - Suspend user
Suspends the user. The suspended user cannot perform any actions.
Endpoint
PUT - /users/:id
Example
/users/derek.trotter@circularo.com?token=sOhWtNzU6TpUgV0WONr5YLtBClcbbB8xKv9jnUe5zaOLC7ueyepoyTtuNckXZStI
Content-Type: application/json
{
"status": "suspended"
}
The user is now suspended.
Step 5 - Activate user
Reactivates the user. The user will be able to perform actions again.
Endpoint
PUT - /users/:id
Example
/users/derek.trotter@circularo.com?token=sOhWtNzU6TpUgV0WONr5YLtBClcbbB8xKv9jnUe5zaOLC7ueyepoyTtuNckXZStI
Content-Type: application/json
{
"status": "active"
}
The user is now active.