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.
getUsers()
method below. The code snippet below shows how to get a list of users with full_name
containing John
, sorted by the updated_at
field in descending order, and limited to 10 users on the page.
getUsers()
accepts one (optional) argument of the object type that has the following fields:
Field | Required | Desription |
---|---|---|
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. |
ge | number, string, date | id, created_at, updated_at, last_request_at, external_user_id, facebook_id | Greater Than or Equal to operator. |
gt | number, string, date | id, created_at, updated_at, last_request_at, external_user_id, facebook_id | Greater Than 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 the 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 the ascending order by setting the ascending as false. |
field | String, Number, Date | id, full_name, email, login, phone, website, created_at, updated_at, last_request_at, external_user_id | Sort Field Value |
type | String, Number, Date | id, full_name, email, login, phone, website, created_at, updated_at, last_request_at, external_user_id | Type of Sort Field Value |
update()
method. If you want to change your password, you need to provide 2 parameters: password
and newPassword
. As a result, the updated user entity will be returned.
You can update any other field of the user using the updateUser()
method. Thus, the snippet below shows how to update a tagList
and customData
fields.
update()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
customData | no | User custom data. Should be a String. You can convert any data types to String. For example, JSON, XML, etc. |
tags | no | User tags. An array of Strings. A tag must include alphanumeric characters only and start with a letter. 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 that 10 tags are provided, an error is returned: Error: tag list should contain maximum 10 tags |
upload()
method and pass the fileUrl
to it. The fileUrl
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 update()
method. As a result, the user avatar gets updated.
update()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
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 and getInfo()
method.
getPrivateUrl()
method accepts one argument of the object type that has the following fields:
Field | Required | Description |
---|---|---|
uid | yes | A file unique indetifier. |