Learn how to manage your users with QuickBlox.
createUser()
method.
Create a user using the code snippet below. Only login (or email) and password are required. Other fields are optional.
Argument | Required | Description |
---|---|---|
login | yes | User login. |
password | yes | User password. |
no | User email. | |
blobId | no | User blob ID. |
externalUserId | no | User external ID. |
facebookId | no | User facebook ID. |
twitterId | no | User twitter ID. |
fullName | no | User full name. |
phone | no | User phone. |
website | no | User website. |
customData | no | User custom data. |
tagList | no | User tag list. |
getUsers()
method. The code snippet below shows how to get a list of users created between the two given dates, sorted in descending order, and limited to 100 users on the page.
getUsers()
accepts two (optional) arguments of the object type that can have the following fields:
Field | Required | |
---|---|---|
filter | no | Specifies filtering criteria for the field. |
sort | no | Specifies sorting criteria for the field. |
page | no | Number of pages with results to be returned. |
perPage | no | Number of records to return in one page. |
Search operators | Applicable to types | Applicable to fields | Description |
---|---|---|---|
lt | number, string, date | id, created_at, updated_at, last_request_at, external_user_id, facebook_id | Less Than operator. |
gt | number, string, date | id, created_at, updated_at, last_request_at, external_user_id, facebook_id | Greater Than operator. |
ge | number, string, date | id, created_at, updated_at, last_request_at, external_user_id, facebook_id | Greater Than or Equal to operator. |
le | number, string, date | id, created_at, updated_at, last_request_at, external_user_id, facebook_id | Less or Equal to operator |
eq | number, string, date | id, full_name, email, login, phone, created_at, updated_at, last_request_at, external_user_id, facebook_id | Equal to operator. |
ne | number, string, date | id, full_name, email, login, phone, created_at, updated_at, last_request_at, external_user_id, facebook_id | Not Equal to operator. |
between | number, string, date | id, created_at, updated_at, last_request_at, external_user_id, facebook_id | Contained between values operator. |
in | number, string, date | id, full_name, email, login, phone, created_at, updated_at, last_request_at, external_user_id, facebook_id | IN array operator. |
Sort options | Applicable to types | Applicable to fields | Description |
---|---|---|---|
ascending | All types | id, full_name, email, login, phone, website, created_at, updated_at,last_request_at, external_user_id | Sort results in ascending order by setting the ascending as true. |
descending | All types | id, full_name, email, login, phone, website, created_at, updated_at,last_request_at, external_user_id | Sort results in descending order by setting the ascending as false. |
Argument | Required | Description |
---|---|---|
fullName | yes | A string of fullName |
page | no | Number of pages with results to be returned. Default: 1. |
perPage | no | Number of records to return in one page. Min: 1. Default: 100. |
Argument | Required | Description |
---|---|---|
tags | yes | An array of tags. Min: 1. |
page | no | Number of pages with results to be returned. Default: 1. |
perPage | no | Number of records to return in one page. Min: 1. Default: 100. |
updateUser()
method. If you want to change your password, you need to provide 2 parameters: password
and newPassword
. The updated user
entity will be returned. You can also update any other field of the user using the updateUser()
method. Thus, the snippet below shows how to update a tagList
and customData
fields.
Argument | Required | Description |
---|---|---|
login | yes | User login. |
customData | no | User custom data. Should be a String. You can convert any data types to String, for example, JSON, XML , etc. |
tagList | no | User tags. A comma separated String without any spaces. A tag should contain alphanumeric characters and start with a letter. For example, the “tagOne” format is correct while the “tag one” format is incorrect. If more that 10 tags are provided, an error is returned: tag list should contain maximum 10 tags. |
upload()
method and pass the imageFileUrl
to it. The imageFileUrl
is a path to the file in the device filesystem. Now that the file is uploaded, get the ID of the uploaded file.
To connect the file to the user, set the ID of the uploaded file to the blobId
field of the user
and call the updateUser()
method. As a result, the user avatar gets updated.
updateUser()
method:
Argument | Required | Description |
---|---|---|
userLogin | yes | User login. |
blobId | no | User blob ID. |
getPrivateURL()
method. As a result, you will receive a private URL in the response. See this section to learn more about file URLs.