GET
/
chat
/
Dialog.json
curl -X GET \
-H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
https://api.quickblox.com/chat/Dialog.json?limit=2
{
  "total_entries": 6,
  "skip": 0,
  "limit": 2,
  "items": [
    {
      "_id": "5d75393ba28f9a17e1cb0f9e",
      "created_at": "2019-09-08T17:24:11Z",
      "last_message": "sure, I can wait",
      "last_message_date_sent": 1567971414,
      "last_message_id": "5d755856a0eb47411e0b72a9",
      "last_message_user_id": 96753878,
      "name": "New Year party",
      "occupants_ids": [
        96753878,
        96754523,
        96830631,
        96831328,
        96831397
      ],
      "photo": "68123",
      "type": 2,
      "updated_at": "2019-09-08T19:36:54Z",
      "user_id": 96753878,
      "xmpp_room_jid": "76730_5d75393ba28f9a17e1cb0f9e@muc.chat.quickblox.com",
      "unread_messages_count": 0
    },
    {
      "_id": "5d753421a28f9a2596cb0f98",
      "created_at": "2019-09-08T17:02:26Z",
      "last_message": "let's do it at 7pm",
      "last_message_date_sent": 1567971391,
      "last_message_id": "5d75583fa0eb473c350b72ab",
      "last_message_user_id": 96753878,
      "name": "Daniel's birthday",
      "occupants_ids": [
        96753878,
        96754523,
        96830631,
        96831328,
        96831397
      ],
      "photo": "68123",
      "type": 2,
      "updated_at": "2019-09-08T19:36:31Z",
      "user_id": 96753878,
      "xmpp_room_jid": "76730_5d753421a28f9a2596cb0f98@muc.chat.quickblox.com",
      "unread_messages_count": 0
    }
  ]
}

Recipes

Search Operators

The request can contain all, some or none of the next search operators.

OperatorDescription
ltLess Than operator

Types: number, string, date

Applicable to fields: last_message_date_sent, created_at, updated_at

Example:
?updated_at[lt]=1556829805

Will return dialogs with updated_at less than 1556829805.
lteLess Than or Equal to operator

Types: number, string, date

Applicable to fields: last_message_date_sent, created_at, updated_at

Example:
?last_message_date_sent[lte]=1556735709

Will return dialogs with last_message_date_sent less than or equal 1556735709.
gtGreater Than operator

Types: number, string, date

Applicable to fields: last_message_date_sent, created_at, updated_at

Example:
?last_message_date_sent[gt]=1556735709

Will return dialogs with last_message_date_sent greater than 1556735709.
gteGreater Than or Equal to operator

Types: number, string, date

Applicable to fields: last_message_date_sent, created_at, updated_at

Example:
?last_message_date_sent[gt]=1556735709

Will return dialogs with last_message_date_sent greater than 1556735709.
neNot Equal to operator

Types: number, string, date

Applicable to fields: _id, name, last_message_date_sent

Example:

?_id[ne]=5cc9bb58a28f9a406659d777

Will return dialogs with _id not equal to 5cc9bb58a28f9a406659d777.
inContained IN array operator

Types: number, string, date

Applicable to fields: type, last_message_date_sent, name

Example:
?type[in]=1,2

Will return dialogs with type equal to 1 and equal to 2.
ninNot contained IN array operator

Types: number, string, date

Applicable to fields: last_message_date_sent

Example:
?last_message_date_sent[nin]=1556739654, 1556739987

Will return dialogs with last_message_date_sent not equal to 1556739654 and 1556739987.
allALL contained IN array

Types: number

Applicable to fields: occupants_ids

Example:
?occupants_ids[all]=91103344,91142495

Will return dialogs with occupants_ids equal to 91103344 and 91142495 (both).
ctnContains substring operator

Types: string

Applicable to field: name

Example: ?name[ctn]=party

Returns dialogs whose name contains the word “party”.

Sort Operators

Next sorting operators are allowed:

OperatorDescription
sort_ascTypes: all types

Example: sort_asc=field_name

Search results will be sorted by the specified field in ascending order.
sort_descTypes: all types

Example:
sort_desc=field_name

Search results will be sorted by the specified field in descending order.

Query Parameters

{dialog_field_N}
string
Search records with the field that contains the specified value. Can be many 1..N.
{dialog_field_N}[{search_operator}]
string
Filters records with field that contains the value according to the specified value and operator. Can be many 1..N.
include_unread_message_count
integer
default:"Defaults to 1"

Unread message count is calculated for dialogs by default. Set to 0 to skip calculation, which will speed up the request.
Added in v2.4.5.

limit
integer
default:"Defaults to 100"
Limit search results to N records. Useful for pagination.
skip
string
default:"Defaults to 0"
Skip N records in search results. Useful for pagination.
count
string
Count search results. Set to 1 to apply. Response will contain only count of records found. If not passed, the response will contain all available dialog records along with their count.
sort_desc
string
Search results will be sorted by the specified field in descending order.
sort_asc
string
Search results will be sorted by the specified field in ascending order.
data[class_name]
string
Class name in Custom Objects.
data[{class_field_N}]
string
Field name of class in Custom Objects. Can be many 1..N.

Headers

QB-Token
string
required
A user or application session token. See our Authentication page to learn more about session tokens. Must be used either QB-Token or Authorization.
Authorization
string
default:"ApiKey {your_api_key}"
API key from Dashboard. Expected format: ApiKey {your_api_key}. Must be used either QB-Token or Authorization.
On-Behalf-Of
string
User ID. The user ID of the user on whose behalf the request is being made.

Responses

curl -X GET \
-H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
https://api.quickblox.com/chat/Dialog.json?limit=2
{
  "total_entries": 6,
  "skip": 0,
  "limit": 2,
  "items": [
    {
      "_id": "5d75393ba28f9a17e1cb0f9e",
      "created_at": "2019-09-08T17:24:11Z",
      "last_message": "sure, I can wait",
      "last_message_date_sent": 1567971414,
      "last_message_id": "5d755856a0eb47411e0b72a9",
      "last_message_user_id": 96753878,
      "name": "New Year party",
      "occupants_ids": [
        96753878,
        96754523,
        96830631,
        96831328,
        96831397
      ],
      "photo": "68123",
      "type": 2,
      "updated_at": "2019-09-08T19:36:54Z",
      "user_id": 96753878,
      "xmpp_room_jid": "76730_5d75393ba28f9a17e1cb0f9e@muc.chat.quickblox.com",
      "unread_messages_count": 0
    },
    {
      "_id": "5d753421a28f9a2596cb0f98",
      "created_at": "2019-09-08T17:02:26Z",
      "last_message": "let's do it at 7pm",
      "last_message_date_sent": 1567971391,
      "last_message_id": "5d75583fa0eb473c350b72ab",
      "last_message_user_id": 96753878,
      "name": "Daniel's birthday",
      "occupants_ids": [
        96753878,
        96754523,
        96830631,
        96831328,
        96831397
      ],
      "photo": "68123",
      "type": 2,
      "updated_at": "2019-09-08T19:36:31Z",
      "user_id": 96753878,
      "xmpp_room_jid": "76730_5d753421a28f9a2596cb0f98@muc.chat.quickblox.com",
      "unread_messages_count": 0
    }
  ]
}