Learn how to manage your users with QuickBlox.
create()
method.
Create a user using the code snippet below. Only login (or email) and password are required. Other fields are optional.
listUsers()
method. The code snippet below shows how to get a list of users created between the two given dates, sorted in ascending order, with 50
users on the page.
filter
:
Field | Required | Description |
---|---|---|
page | no | Number of pages with results to be returned. |
per page | 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. |
gte | 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. |
created_at
field sorted in descending order.
Sort operator | Applicable to types | Applicable to fields | Description |
---|---|---|---|
asc | All types | id, full_name, email, login, phone, website, created_at, updated_at,last_request_at, external_user_id | Search results will be sorted in ascending order by the specified field. |
desc | All types | id, full_name, email, login, phone, website, created_at, updated_at,last_request_at, external_user_id | Search results will be sorted in descending order by the specified field. |
ExternalID
field) in QBUser
model to link users from QuickBlox with users from your external database.
updateUser()
method. If you want to change your password, you need to provide 2 parameters: password
and old_password
. As a result, the updated user entity will be returned.
You can update any other field of the user using the update()
method. Thus, the snippet below shows how to update a tag_list
and custom_data
fields.
Field | Required | Description |
---|---|---|
tag_list | no | User tags. An array of Strings. There are no spaces in the tag format. For example, the “tagOne” format is correct while the “tag one” format is incorrect. The maximum number of tags is 10. If more than 10 tags are provided, an error is returned: tag list should contain maximum 10 tags. |
custom_data | no | User custom data. Should be a String. You can convert any data types to String, or example, JSON, XML, etc. |
createAndUpload()
method. 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 blob_id
field of the user
and call the update()
method. As a result, the user avatar gets updated.
update()
method.
Argument | Required | Description |
---|---|---|
userId | yes | User ID. |
updatedUserProfile | yes | Specifies the updatedUserProfile fields that should be set. |
function | yes | Specifies a callback function that accepts an error and updated user entity. |