# Users Create new user --------- ```eval_rst .. http:put:: /aalam/base/users ``` Create a new user. If user is a 'human', an invite will be sent tothe new user's email_id. **Permissions** *Permissions* _all_ of the following permissions - Users/manage **Outputs** - Create a new user successfully. *Status code*: 200 - User already exists. *Status code*: 409 **Inputs** - *Content type*: application/json *Content specification* ``` { "email_id": "Email of the user to be created", "mobile_isd_code": "Isd number of the mobile number", "mobile_number": "The actual mobile number", "type": If present, it should be one among ['human', 'system', 'app', 'temp', 'remote']. Defaults to: 'human'" } ``` Delete user --------- ```eval_rst .. http:delete:: /aalam/base/user/{email_id} ``` Delete a user from the portal. **Permissions** *Permissions* _all_ of the following permissions - Users/manage **Outputs** - Delete user successfully *Status code*: 200 - Forbidden to delete a user email id. It can be because the user the administrator or some user ids that are reserved. *Status code*: 403 Get user --------- ```eval_rst .. http:get:: /aalam/base/user/{email_id} ``` Get the details of a user. **Permissions** *Flags* - deny_anon **Parameters** - permissions > No value needed. Signifies that the caller is requesting the list of permissions of the user. - groups > No value needed. Signifies that the caller is requesting the list of groups that user is part of. **Outputs** - *Status code*: 200 *Content type*: application/json *Content specification* ``` { "name": "Name of the user", "type": "Type of the user, one among ['human', 'app', 'temp', 'system']" "permissions": "Will be present when 'permissions' is in the parameters. When email_id is not 'self', this field will be set only if the user is either an admin or has 'aalam/base/Users/manage' permission." "groups": "Will be present when 'groups' is in the parameters. When email_id is not 'self', this field will be set only if the user is either an admin or has 'aalam/base/Users/manage' permission." } ``` - User not found *Status code*: 404 Assign permission --------- ```eval_rst .. http:put:: /aalam/base/user/{email_id} ``` Assign a set of permissions to a user **Permissions** *Permissions* _all_ of the following permissions - Users/manage **Outputs** - Permission assigned to user successfully. *Status code*: 200 - User not found. *Status code*: 404 **Inputs** - List of permission to assign the user *Content type*: application/json *Content specification* ``` { "permissions": [List of fully qualified permission names] } ``` Revoke permission --------- ```eval_rst .. http:delete:: /aalam/base/user/{email_id}/permission/{provider}/{app}/{perm_group}/{permission} ``` Revoke a permission for a user. **Permissions** *Permissions* _all_ of the following permissions - Users/manage **Outputs** - Revoked successfully. *Status code*: 200 - Either the user or permission is not found. *Status code*: 404 Get users --------- ```eval_rst .. http:get:: /aalam/base/users ``` Get the list of users based after applying certain filters. **Permissions** *Flags* - deny_anon **Parameters** - fields > List of fields to be presented in the output, separated by comma. Valid values are - ['id', 'name', 'email', 'type']. - id > Filter user with id of this value. - name > Filter user with name of this value. - type > Filter users of type of this value. - email > Filter users of email_id of this value. **Outputs** - The output fields vary based on the 'fields' parameter value. *Status code*: 200 *Content type*: application/json *Content specification* ``` { "id": "Integer user identifier", "name": "Name of the user", "type": "Type of the user", "email": "Email id of the user" } ``` Get remote app/device token --------- ```eval_rst .. http:get:: /aalam/base/user/{remote_id}/token ``` Generates a new token to be sent along with the requests fromremote apps or devices. **Permissions** *Flags* - deny_anon **Outputs** - *Status code*: 200 *Content type*: application/json *Content specification* ``` { "token": "Token value" } ```