REST API User Management
For each call, you can add the following command:
-w"\n%{http_code}\n"
After the username and password in order to receive more meaningful HTTP errors.
View All User Management REST API
Request method - OPTIONS
Description
Returns an HTTP response in JSON representation with all information on available REST APIs for user management. Use this representation to understand the different commands you can execute for user management. Each REST API listed contains the path, method, and required parameters. You can use the REST APIs in this representation to change what is returned for the other calls in user management.
URI syntax
curl -u '<username>:<password>' -X OPTIONS http://<Datameer-serverIP>:<port-number>/rest/user-management?pretty
Example response
List All Groups
Request method - GET
Description
Returns a list of all the created group names in Datameer.
URI syntax
curl -u '<username>:<password>' -X GET http://<Datameer-serverIP>:<port-number>/rest/user-management/groups
Example response
{ "name": "datameer" }, { "name": "group 1" }, { "name": "group 2" }, { "name": "group 3" }, { "name": "Shark Team" }, { "name": "Special Team" }
List All Roles
Request method - GET
Description
Returns a list of all the created role names in Datameer.
URI syntax
curl -u '<username>:<password>' -X GET http://<Datameer-serverIP>:<port-number>/rest/user-management/roles
Example response
{ "name": "ADMIN" }, { "name": "ANALYST" }, { "name": "App Operator" }, { "name": "News" }, { "name": "Illustrator" }, { "name": "ANALYST2" }, { "name": "ANALYST3" }, { "name": "VARIABLES_EDIT" }, { "name": "VARIABLES_READ" }
List All Users
Request method - GET
Description
Returns a list of all the users and their information including Datameer version, user name, email address, active/inactive, expiration date, group(s), and role(s). The information you see is configurable as per View all user management REST API. You can also return the information for a specified user.
URI syntax
One user:
curl -u '<username>:<password>' -X GET http://<Datameer-serverIP>:<port-number>/rest/user-management/users/<user name>
First page of (ten) users:
curl -u '<username>:<password>' -X GET http://<Datameer-serverIP>:<port-number>/rest/user-management/users/
To see the next page of users:
curl -u '<username>:<password>' -X GET http://<Datameer-serverIP>:<port-number>/rest/user-management/users?firstResult=11
To increase the number of users per page, change the results value:
curl -u '<username>:<password>' -X GET http://<Datameer-serverIP>:<port-number>/rest/user-management/users?maxResults=50
Example response
One user:
{ "username": "Frank", "email": "Frank@email.com", "additionalInformation": "", "enabled": true, "expires": "", "groups": [], "roles": ["ANALYST"], "lastLoginDate": "", "loginCount": 0, "datameerVersion":"5.11.0" }
All users:
{ "firstResult": 0, "maxResults": 10, "total": 3, "elements": [ { "username": "admin", "_links": { "self": { "href": "/rest/user-management/users/admin" }, "delete": { "method": "DELETE", "permitted": false, "href": "/rest/user-management/users/admin" }, "modify": { "method": "PUT", "permitted": true, "href": "/rest/user-management/users/admin" } } }, { "username": "analyst", "_links": { "self": { "href": "/rest/user-management/users/analyst" }, "delete": { "method": "DELETE", "permitted": true, "href": "/rest/user-management/users/analyst" }, "modify": { "method": "PUT", "permitted": true, "href": "/rest/user-management/users/analyst" } } }, { "username": "colin", "_links": { "self": { "href": "/rest/user-management/users/colin" }, "delete": { "method": "DELETE", "permitted": true, "href": "/rest/user-management/users/colin" }, "modify": { "method": "PUT", "permitted": true, "href": "/rest/user-management/users/colin" } } } ], "datameerVersion": "5.11.0" }
Logged In User Account Information
Request method - GET
Description
Returns account information about a specific Datameer user.
URI syntax
curl -u '<username>:<password>' -X GET http://<Datameer-serverIP>:<port-number>/rest/user-management/logged-in-user?pretty
Example response
{ "username": "admin", "email": "admin@localhost", "additionalInformation": "", "enabled": true, "expires": "", "groups": [IT-Dept.], "roles": ["ADMIN"], "capabilities": ["HADOOP_CLUSTER_ACCESS","EXPORTJOB_EDIT"], "internal": false, "lastLoginDate": "", "loginCount": 0 }
Create a User
Request method - POST
Description
Creates an internal user in Datameer.
URI syntax
curl -u '<username>:<password>' -d '{username:"<user name>", email:"<user's email address>", roles : [<role>]}' -X POST http://<Datameer-serverIP>:<port-number>/rest/user-management/users
Example response
{ "version": "3.1", "username": "Robert", "email": "Robert@email.com", "enabled": true, "expires": "", "groups": [], "roles": [ "ANALYST" ] }
Additional notes
- Optional parameter
- notifyPerMail=true (sends an account creation email to user)
- Mandatory fields:
- username:"<username>"
- email:"<email>"
- roles: [<role_1>,...,<role_N>] > each role must exist
- Optional fields:
- groups:[<group_1>,..., <group_N>] > each group must exist
- enabled:<true|false>
- expires:"<yyyy-MM-dd>"
- version:"<version>"
Import a User from External Authenticator
Request method - POST
Description
Adds a user in Datameer taken from a 3rd party authenticator.
URI syntax
curl -u '<username>:<password>' -d '{username:"<user name>", roles:[<role>]}' -X POST http://<Datameer-serverIP>:<port-number>/rest/user-management/users
Example response
{ "version": "3.1", "username": "Joel", "email": "Joel@email.com", "enabled": true, "expires": "", "groups": [ "datameer" ], "roles": [ "ANALYST" ] }
Additional notes
- Mandatory fields:
- username:"<username>"
- roles: [<role_1>,...,<role_N>] > each role must exist
- Optional fields:
- enabled:<true|false>
- version:"<version>"
- Not supported fields:
- groups
- expires
Update a User
Request method - PUT
Description
Updates a Datameer user's account.
URI syntax
curl -u '<username>:<password>'-d '{version:"<version number>", email:"<user's email address>", roles : [<role>]}' -X PUT http://<Datameer-serverIP>:<port-number>/rest/user-management/users/<user name>
Example response
{ "version": "3.1", "username": "Robert", "email": "RobertSmith@email.com", "enabled": true, "expires": "", "groups": [], "roles": [ "ANALYST" ] }
Additional notes
- Optional fields:
- roles: [<role_1>,...,<role_N>] > each role must exist
- enabled:<true|false>
- groups:[<group_1>,..., <group_N>] > each group must exist
- expires:"<yyyy-MM-dd>"
- Not supported fields:
- username:"<username>"> username can never be changed
Update a User Imported From an External Authenticator
Request method - PUT
Description
Updates a Datameer user's account who authenticates from a 3rd party authenticator.
URI syntax
curl -u '<username>:<password>' -d '{roles : [<role>]}' -X PUT http://<Datameer-serverIP>:<port-number>/rest/user-management/users/<user name>
Example response
{ "version": "3.1", "username": "Joel", "email": "Joel@email.com", "enabled": true, "expires": "", "groups": [ "datameer" ], "roles": [ "ANALYST" ] }
Additional notes
- Optional fields:
- enabled:<true|false>
- roles: [<role_1>,...,<role_N>] > each role must exist
- Not supported fields
- groups
- expires
Delete a User
Request method - DELETE
Description
Deletes a user from Datameer.
URI syntax
curl -u '<username>:<password>' -X DELETE http://<Datameer-serverIP>:<port-number>/rest/user-management/users/<user name>
Example response
No confirmation/response
Set or Update Password to Existing User
Request method - PUT
Description
Sets or updates a user password.
URI syntax
curl -u '<username>:<password>'-d '<passowrd>' -X PUT http://<Datameer-serverIP>:<port-number>/rest/user-management/password/<user name>
Example response
No confirmation/response
Send Notification When Setting or Updating a Password
Request method - PUT
Description
Sets or updates a user password. Sends a notification email to the user they password had been updated.
URI syntax
curl -u '<username>:<password>'-d '<password>' -X PUT http://<Datameer-serverIP>:<port-number>/rest/user-management/password/<user name>?notifyPerMail=true
Example response
No confirmation/response
Send Notification When Creating a User
Request method - POST
Description
Creates a Datameer user and emails the user a notification the account has been made.
URI syntax
curl -u '<username>:<password>' -d '{version:"<version number>", username:"<user name>", email:"<user's email>", roles : [<role>]}' -X POST http://<Datameer-serverIP>:<port-number>/rest/user-management/users?notifyPerMail=true
Example response
{ "version": "3.1", "username": "RobertSmith", "email": "RobertSmith@email.com", "enabled": true, "expires": "", "groups": [], "roles": [ "ANALYST" ] }
Create a Role
Request method - POST
Description
Creates an internal role in Datameer.
URI syntax
curl -u '<username>:<password>'-X POST -d"{name:"test",capabilities:[list capabilities]}" http://<Datameer-serverIP>:<port-number>/rest/user-management/roles/
Example response
{"name":"test", "capabilities":["USERS_ACCESS","USER_MANAGEMENT_ACCESS","ADMINISTRATION_ACCESS"], "datameerVersion":"6.1.0"}
Delete a Role
Request method - DELETE
Description
Deletes an internal role in Datameer.
URI syntax
curl -u '<username>:<password>'-X DELETE http://<Datameer-serverIP>:<port-number>/rest/user-management/roles/<role-name>
Example response
No confirmation/response
Update a Role
Request method - PUT
Description
Updates an internal role in Datameer.
URI syntax
curl -u '<username>:<password>'-X PUT -d "{name:"name",capabilities:[capabilties]}" http://<Datameer-serverIP>:<port-number>/rest/user-management/roles/<role-name>
Example response
{"name":"tests", "capabilities["WORKBOOK_DOWNLOAD","EXPORTJOB_EXECUTE","EXPORTJOB_ACCESS","IMPORTJOB_ACCESS","WORKBOOK_EXECUTE","SHARE_WITH_FOREIGN_GROUPS_ACCESS","CONNECTION_ACCESS","FOLDER_CREATE","ARCHIVE_PROJECT","FOLDER_CREATE_IN_HOME","IMPORTJOB_EXECUTE","FILEUPLOAD_EDIT","INFOGRAPHICS_SHARE_PUBLIC","FILE_BROWSER_ACCESS","WORKBOOK_ACCESS","FOLDER_BACKUP","DATALINK_ACCESS","FILEUPLOAD_ACCESS","EXPORTJOB_EDIT","IMPORTJOB_EDIT","INFOGRAPHICS_ACCESS","SHARE_WITH_OTHERS_ACCESS","CONNECTION_EDIT","IMPORTJOB_DOWNLOAD","WORKBOOK_EDIT","USER_CAN_ACCESS_EVERYTHING","USER_CAN_EDIT_EVERYTHING","DATALINK_EDIT","FOLDER_RESTORE","INFOGRAPHICS_EDIT"]
Create a Group
Request method - POST
Description
Creates an internal group in Datameer.
This REST API call is only available if you use an internal authenticator or a mixed-mode authenticator. This call doesn't work if you use LDAP or SAML authentication and the internal authenticator is disabled.
URI syntax
curl -u '<username>:<password>'-X POST -d '{name:"group"}' http://<Datameer-serverIP>:<port-number>/rest/user-management/groups/
Example response
{"name":"testgroup", "datameerVersion":"6.1.0"}
Delete a Group
Request method - DELETE
Description
Deletes an internal group in Datameer.
This REST API call is only available if you use an internal authenticator or a mixed-mode authenticator. This call doesn't work if you use LDAP or SAML authentication and the internal authenticator is disabled.
URI syntax
curl -u '<username>:<password>'-X DELETE http://<Datameer-serverIP>:<port-number>/rest/user-management/groups/<group-name>
Example response
No confirmation/response
Update a Group
Request method - PUT
Description
Updates an internal group in Datameer.
This REST API call is only available if you use an internal authenticator or a mixed-mode authenticator. This call doesn't work if you use LDAP or SAML authentication and the internal authenticator is disabled.
URI syntax
curl -u '<username>:<password>'-X PUT -d '{name:"group"}' http://<Datameer-serverIP>:<port-number>/rest/user-management/groups/<group-name>
Example response
{"name":"group", "datameerVersion":"6.1.0"}
If your file name includes " "
(empty spaces), replace those spaces with "+"
.