Skip to main content
PUT
/
data
/
{class_name}
/
by_criteria.json
curl -X PUT \
-H "Content-Type: application/json" \
-H "QB-Token: 0bea0abd041b2431e5e1c2d0b06fab4414012bba" \
-d '{
  "game_mode_name":"beta testing",
  "search_criteria":{
    "expert_mode":"false",
    "progress":{
      "gt":"0.2"
    }
  }
}' \
https://api.quickblox.com/data/ScoreTable/by_criteria.json
{
  "class_name": "ScoreTable",
  "skip": 0,
  "limit": 100,
  "total_found": 2,
  "items": [
    {
      "_id": "5d866b53a28f9a5ad51cb562",
      "_parent_id": null,
      "completed_levels": [
        1,
        2,
        3,
        4
      ],
      "created_at": 1569090387,
      "date": "2019-09-21T21:21:00Z",
      "expert_mode": false,
      "game_mode_name": "beta testing",
      "progress": 0.23,
      "score_value": 705,
      "updated_at": 1569177307,
      "user_avatar": null,
      "user_id": 96753878,
      "user_location": [
        11.13,
        45.52
      ],
      "permissions": {
        "read": {
          "access": "open"
        },
        "update": {
          "access": "owner"
        },
        "delete": {
          "access": "owner"
        }
      }
    },
    {
      "_id": "5d867291a0eb473ed96099c4",
      "_parent_id": null,
      "completed_levels": [
        1,
        2,
        3,
        4,
        5,
        6
      ],
      "created_at": 1569092241,
      "date": "2019-09-21T21:25:00Z",
      "expert_mode": false,
      "game_mode_name": "beta testing",
      "progress": 0.42,
      "score_value": 3021,
      "updated_at": 1569177307,
      "user_avatar": null,
      "user_id": 96753878,
      "user_location": null,
      "permissions": {
        "read": {
          "access": "open"
        },
        "update": {
          "access": "owner"
        },
        "delete": {
          "access": "owner"
        }
      }
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.quickblox.com/llms.txt

Use this file to discover all available pages before exploring further.

Recipes

1

1. Use 'Authorization' header to pass API key

curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-d '{
  "game_mode_name":"beta testing",
  "search_criteria":{
    "expert_mode":"false",
    "progress":{
      "gt":"0.2"
    }
  }
}' \
https://api.quickblox.com/data/ScoreTable/by_criteria.json
2

2. As a result, the API returns the number of updated records.

{
  "class_name": "ScoreTable",
  "skip": 0,
  "limit": 100,
  "total_found": 2,
  "items": [
    {
      "_id": "5d866b53a28f9a5ad51cb562",
      "_parent_id": null,
      "completed_levels": [
        1,
        2,
        3,
        4
      ],
      "created_at": 1569090387,
      "date": "2019-09-21T21:21:00Z",
      "expert_mode": false,
      "game_mode_name": "beta testing",
      "progress": 0.23,
      "score_value": 705,
      "updated_at": 1569177307,
      "user_avatar": null,
      "user_id": 96753878,
      "user_location": [
        11.13,
        45.52
      ],
      "permissions": {
        "read": {
          "access": "open"
        },
        "update": {
          "access": "owner"
        },
        "delete": {
          "access": "owner"
        }
      }
    },
    {
      "_id": "5d867291a0eb473ed96099c4",
      "_parent_id": null,
      "completed_levels": [
        1,
        2,
        3,
        4,
        5,
        6
      ],
      "created_at": 1569092241,
      "date": "2019-09-21T21:25:00Z",
      "expert_mode": false,
      "game_mode_name": "beta testing",
      "progress": 0.42,
      "score_value": 3021,
      "updated_at": 1569177307,
      "user_avatar": null,
      "user_id": 96753878,
      "user_location": null,
      "permissions": {
        "read": {
          "access": "open"
        },
        "update": {
          "access": "owner"
        },
        "delete": {
          "access": "owner"
        }
      }
    }
  ]
}
You can update records by criteria using the search_criteria operator. All parameters that are not included in the search criteria will be considered as parameters for updating the fields of records found by the search criteria. You can use all search operators listed below the request. Search operators The request can contain all, some or none of the next search operators:
OperatorDescription
ltLess Than operator

Types: integer, float

Example:
score_value[lt]=1000
lteLess Than or Equal to operator

Types: integer, float

Example:
score_value[lte]=850
gtGreater Than operator

Types: integer, float

Example:
bonus_count[gt]=2.45
gteGreater Than or Equal to operator

Types: integer, float

Example:
bonus_count[gte]=56.443
neNot Equal to operator

Types: integer, float, string, boolean

Example:
game_mode_name[ne]=ctf
inContained IN array operator

Types: integer, float, string

Example:
game_mode_name[in]=deathmatch,rage
ninNot contained IN array operator

Types: integer, float, string

Example:
game_mode_name[nin]=survivor,crazy_nightmare
allALL contained IN array operator

Types: array

Example:
game_modes[all]=survivor,crazy
orOR operator

Types: integer, float, string

Example:
name[or]=sam,tim
name[or]=sam&lastname[or]=johnson

Will return records with name sam or tim.
Will return records with name sam or last name johnson.
ctnContains substring operator

Types: string

Example:
username[ctn]=son

Will return all records where username field contains son substring.
nearTypes: location

Example:
mylocation[near]=25.32,44.551;1000

Search records in a specific radius with
the current position in meters.
Format: {field_name}[near]=longitude,latitude;radius.
Allowed permissions
PermissionSyntaxExample
Openpermissions.<CRUD_operation>.accesspermissions.read.access=open
Ownerpermissions.<CRUD_operation>.accesspermissions.read.access=owner
Open for users IDspermissions.<CRUD_operation>.access=open_for_users_ids permissions.<CRUD_operation>.ids=id_1,id_2,id_3,…permissions.update.access=open_for_users_ids permissions.update.ids=3,12
Open for groupspermissions.<CRUD_operation>.access=open_for_groups permissions.<CRUD_operation>.groups=group_name_1,group_name_2permissions.delete.access=open_for_groups permissions.delete.groups=experience,rate

Path Parameters

class_name
string
required
Custom object class name.

Body Parameters

{custom_field_N}
string
Update value to the field defined in Custom Object class.
search_criteria
object
permissions
string
Record permissions. Format:
permission.<CRUD_operation>.access=<value>
permission.<CRUD_operation>.<option>=<value>
CRUD operations: create, read, update, delete.
CRUD access values: open, owner, open_for_users_ids, open_for_groups.
CRUD options: ids, groups.

Headers

QB-Token
string
required
A user or application session token. See 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

A successful response
class_name
string
skip
integer
limit
integer
total_found
integer
items
array of objects
An error response
curl -X PUT \
-H "Content-Type: application/json" \
-H "QB-Token: 0bea0abd041b2431e5e1c2d0b06fab4414012bba" \
-d '{
  "game_mode_name":"beta testing",
  "search_criteria":{
    "expert_mode":"false",
    "progress":{
      "gt":"0.2"
    }
  }
}' \
https://api.quickblox.com/data/ScoreTable/by_criteria.json
{
  "class_name": "ScoreTable",
  "skip": 0,
  "limit": 100,
  "total_found": 2,
  "items": [
    {
      "_id": "5d866b53a28f9a5ad51cb562",
      "_parent_id": null,
      "completed_levels": [
        1,
        2,
        3,
        4
      ],
      "created_at": 1569090387,
      "date": "2019-09-21T21:21:00Z",
      "expert_mode": false,
      "game_mode_name": "beta testing",
      "progress": 0.23,
      "score_value": 705,
      "updated_at": 1569177307,
      "user_avatar": null,
      "user_id": 96753878,
      "user_location": [
        11.13,
        45.52
      ],
      "permissions": {
        "read": {
          "access": "open"
        },
        "update": {
          "access": "owner"
        },
        "delete": {
          "access": "owner"
        }
      }
    },
    {
      "_id": "5d867291a0eb473ed96099c4",
      "_parent_id": null,
      "completed_levels": [
        1,
        2,
        3,
        4,
        5,
        6
      ],
      "created_at": 1569092241,
      "date": "2019-09-21T21:25:00Z",
      "expert_mode": false,
      "game_mode_name": "beta testing",
      "progress": 0.42,
      "score_value": 3021,
      "updated_at": 1569177307,
      "user_avatar": null,
      "user_id": 96753878,
      "user_location": null,
      "permissions": {
        "read": {
          "access": "open"
        },
        "update": {
          "access": "owner"
        },
        "delete": {
          "access": "owner"
        }
      }
    }
  ]
}