Users
Cloudera Data Visualization provides URL access to the Cloudera Data Visualization server object, users.
When creating a new user, you must supply the password field. You must also
supply the password field when updating a user's password. Like in the GUI, a
regular user (non-admin) can only change their own password, and must supply the current
password in the old_password field.
Supplying None (or null in the API demo page, the
javascript version of None) for the password makes the user account unusable
for login.
For the list of groups and roles, the name is supplied for
information only. When updating the users's groups or roles,
only the ID fields are necessary.
The examples in this article use an API Key obtained through the Manage API Keys interface,
on the host:port/arc/apps/apikeys browser page of the DataViz
installation. The actual API Key and the method of retrieving the key depends on the user
system.
Here is a CURL example for setting the roles for user ID=3 to IDs 5, 7, and 8.
curl -s \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Authorization: apikey api_key" \
-d 'data=[{"roles": [{"id":5}, {"id":7}, {"id":8}] }]' \
api_url + '/users/3'
Note that the API URL has the form
[http|htttps]://host:port/arc/adminapi/version.
The JSON fields for user's data type are defined as follows:
| Field | Detail Only | Updatable | Description |
|---|---|---|---|
id |
No | No | User ID |
username |
No | Yes | Username, limited to alphanumeric, period, underscore, and dash |
is_superuser |
No | No | Indicates the admin userm, who has full permissions |
is_active |
Yes | No |
|
date_joined |
Yes | No | Shows the creation date for this user's metadata entry |
last_login |
Yes | No | Shows the last login date for this user |
groups |
Yes | Yes | List of groups to which this user belongs; each entry shows group ID and group name |
roles |
Yes | Yes | List of roles to which this user belongs; each entry shows role ID and role name |
