Skip to end of metadata
Go to start of metadata

Use the Users API to manage the built-in list of users in LucidWorks. You do not need to use this API if your installation is configured to pull user information from an LDAP server.

Unlike most of the other APIs in LucidWorks, this API uses the same port as the LWE-UI component. If installed with the default port, that would be at http://localhost:8989.
A fresh installation of LucidWorks contains one role, called DEFAULT, that is allowed to search all documents and the default "admin" user is added to it. The included Search UI requires a role, so if users are not added to the DEFAULT role (or another role that searches all or a subset of documents), those users may not see expected results from queries. A best practice during your application development phase is to add all new users to the DEFAULT role so they see all results.

API Entry Points

/api/users: create a user or get all users

/api/users/username: update, get, or delete a user

Get All Users

GET /api/users

Input

Path Parameters

None

Query Parameters

None

Output

Output Content

Key Type Description
username string The username for the user.  Each username is unique.
email string The user's email address.
authorization string Either admin or search.  Users with 'admin' role can access all parts of the LucidWorks Enterprise UI; users with 'search' role can only access the Search UI.  The authorization is case-sensitive and is always all lower-case.
encrypted_password string A secure hash of the user's password.

Return Codes

200: OK
422: Unprocessable Entity (with cause of error)

Examples

Get a listing of the existing users in the system.

Input

curl 'http://localhost:8989/api/users'

Output

[
  {
    "username": "tommickle",
    "email": "mickle@here.com",
    "authorization": "admin",
    "encrypted_password": "$2a$10$LahkxlPD809eG3tThMoZbe.ceQteNcpyEdhmcUELTyBBSgDqmNSQ6"
  },
  {
    "username": "admin",
    "email": "admin@localhost.com",
    "authorization": "admin",
    "encrypted_password": "$2a$10$LahkxlPD809eG3tThMoZbe.ceQteNcpyEdhmcUELTyBBSgDqmNSQ6"
  },
  {
    "username": "suser",
    "email": "john@there.com",
    "authorization": "search",
    "password": "$2a$10$l1TBrGT/1xXW1cay0HeHe.RmcaH3KFZyGKVQUTVV6eRpn1857ncKm"
  }
]

Create a New User

POST /api/users

Input

Path Parameters

None.

Query Parameters

None.

Input Content

JSON block with all fields.

Key Type Description
username string The username for the user.  Each username must be unique.
email string The user's email address.
authorization string Either admin or search.  Users with 'admin' role can access all parts of the LucidWorks Enterprise UI; users with 'search' role can only access the Search UI.  The value for authorization must always be entered in all lower-case letters.
password string The user's password.
encrypted_password string An alternate to password: a secure hash of the user's password.

Output

Output Content

JSON representing the new user.

Key Type Description
id integer The unique ID for the user.
username string The user's username.
email string The user's email address.
authorization string The authorization for the user.
encrypted_password string The user's password.

Return Codes

201: Created

Examples

Create a new user.

Input

curl -H 'Content-type: application/json' -d '
{
  "username": "smiller",
  "email": "me@here.com",
  "authorization": "search",
  "password": "123456"
}' 'http://localhost:8989/api/users'

Output

{
   "username":"smiller",
   "email":"me@here.com",
   "authorization":"search",
   "encrypted_password":"$2a$10$l1TBrGT/1xXW1cay0HeHe.RmcaH3KFZyGKVQUTVV6eRpn1857ncKm"
}

Get Information About a User

GET /api/users/username

Input

Path Parameters

Key Description
username The unique username of the user.

Query Parameters

None.

Output

Return Codes

200: OK

Examples

Get information on the smiller user.

Input

curl 'http://localhost:8989/api/users/smiller'

Output

{
  "username": "smiller",
  "email": "me@here.com",
  "authorization": "search",
  "password": "$2a$10$l1TBrGT/1xXW1cay0HeHe.RmcaH3KFZyGKVQUTVV6eRpn1857ncKm"
}

Update a User

PUT /api/users/username

Input

Path Parameters

Key Description
username The unique username of the user to be updated.

Query Parameters

None.

Input Content

Not all attributes need to be passed, but they could if they all need to be updated.

Key Type Description
username string The username for the user.
email string The user's email address.
authorization string Either admin or search. Users with 'admin' role can access all parts of the LucidWorks UI (Search and Admin); users with 'search' role can only access the Search UI. The value for authorization must always be entered in all lower-case letters.
password string The user's password.
encrypted_password string An alternate to password: a secure hash of the user's password.

Output

Output Content

None.

Return Codes

204: No Content

Examples

Change the role for the smiller username to "admin", and change the password:

Input

curl -X PUT -H 'Content-type: application/json' -d
'{
     "authorization":"admin",
     "password": "batman"
}'
'http://localhost:8989/api/users/smiller'

Output

None. Check properties to confirm changes.

Remove a User

DELETE /api/users/username

Input

Path Parameters

Key Description
username The unique username of the user to remove

Query Parameters

None.

Input content

None.

Output

Output Content

None.

Return Codes

204: No Content

404: Not Found

Examples

Delete the user smiller.

Input

curl -X DELETE 'http://localhost:8989/api/users/smiller'

Output

None.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.