curl -X GET \
-H "Content-Type: application/json" \
-H "QB-Token: 0bea0abd041b2431e5e1c2d0b06fab4414012bba" \
https://api.quickblox.com/data/ScoreTable.json?score_value[lt]=1000
{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"items": [
{
"_id": "5d866a5aa0eb4753fc6099c3",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
10,
11,
12,
13
],
"created_at": 1569090138,
"date": "2019-09-21T21:21:00Z",
"expert_mode": false,
"game_mode_name": "beta testing4",
"progress": 0.12,
"score_value": 665,
"updated_at": 1569177165,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.13,
45.52
]
}
]
}
List Records
Search for records of a particular class.
curl -X GET \
-H "Content-Type: application/json" \
-H "QB-Token: 0bea0abd041b2431e5e1c2d0b06fab4414012bba" \
https://api.quickblox.com/data/ScoreTable.json?score_value[lt]=1000
{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"items": [
{
"_id": "5d866a5aa0eb4753fc6099c3",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
10,
11,
12,
13
],
"created_at": 1569090138,
"date": "2019-09-21T21:21:00Z",
"expert_mode": false,
"game_mode_name": "beta testing4",
"progress": 0.12,
"score_value": 665,
"updated_at": 1569177165,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.13,
45.52
]
}
]
}
Recipes
Filter records by location
Filter records by location
1. Set a search operator for a field
near operator is applied to a user_location field.curl -X GET \
-H "Content-Type: application/json" \
-H "QB-Token: b97d22aee7773587ede6b2120fda1d0d7c012bba" \
https://api.quickblox.com/data/ScoreTable.json?user_location[near]=11.00,45.40;16800
2. As a result, the API returns records filtered by the specified location.
11.00,45.40;16800 value for the user_location field are turned.{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"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": 1000,
"updated_at": 1574944158,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.12,
45.51
]
},
{
"_id": "5d866a5aa0eb4753fc6099c3",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
10,
11,
12,
13
],
"created_at": 1569090138,
"date": "2019-09-21T21:21:00Z",
"expert_mode": false,
"game_mode_name": "4x4",
"progress": 0.12,
"score_value": 665,
"updated_at": 1569189981,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.13,
45.52
]
}
]
}
Filter records by criteria
Filter records by criteria
1. Set a search operator for a field
lt operator is applied to a score_value custom field.curl -X GET \
-H "Content-Type: application/json" \
-H "QB-Token: 0bea0abd041b2431e5e1c2d0b06fab4414012bba" \
https://api.quickblox.com/data/ScoreTable.json?score_value[lt]=1000
2. As a result, the API returns records filtered upon the request.
score_value less than 1000 are returned.{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"items": [
{
"_id": "5d866a5aa0eb4753fc6099c3",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
10,
11,
12,
13
],
"created_at": 1569090138,
"date": "2019-09-21T21:21:00Z",
"expert_mode": false,
"game_mode_name": "beta testing4",
"progress": 0.12,
"score_value": 665,
"updated_at": 1569177165,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.13,
45.52
]
}
]
}
Group records
Group records
1. Set an aggregation operator for a field to calculate an average for all numeric values
calc aggregation operator is applied to the score_value and set to the avg value.curl -X GET \
-H "Content-Type: application/json" \
-H "QB-Token: 0bea0abd041b2431e5e1c2d0b06fab4414012bba" \
https://api.quickblox.com/data/ScoreTable.json?score_value[calc]=avg&group_by=game_mode_name
2. Set an aggregation operator for a field to group records
game_mode_name field.curl -X GET \
-H "Content-Type: application/json" \
-H "QB-Token: 0bea0abd041b2431e5e1c2d0b06fab4414012bba" \
https://api.quickblox.com/data/ScoreTable.json?score_value[calc]=avg&group_by=game_mode_name
3. As a result, the API returns records grouped according to the request.
gamed_mode_name field with an average calculated for the score_value field.{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"items": [
{
"game_mode_name": "4x4",
"avg": 665
},
{
"game_mode_name": "beta testing",
"avg": 2010.5
},
{
"game_mode_name": "team rumble",
"avg": 1211
}
]
}
Filter records by location with API key
Filter records by location with API key
1. Use 'Authorization' header to pass API key
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/data/ScoreTable.json?user_location[near]=11.00,45.40;16800
2. Set a search operator for a field
near operator is applied to a user_location field.curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/data/ScoreTable.json?user_location[near]=11.00,45.40;16800
3. As a result, the API returns records filtered by the specified location.
11.00,45.40;16800 value for the user_location field are turned.{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"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": 1000,
"updated_at": 1574944158,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.12,
45.51
]
},
{
"_id": "5d866a5aa0eb4753fc6099c3",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
10,
11,
12,
13
],
"created_at": 1569090138,
"date": "2019-09-21T21:21:00Z",
"expert_mode": false,
"game_mode_name": "4x4",
"progress": 0.12,
"score_value": 665,
"updated_at": 1569189981,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.13,
45.52
]
}
]
}
Filter records by criteria with API key
Filter records by criteria with API key
1. Use 'Authorization' header to pass API key
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/data/ScoreTable.json?score_value[lt]=1000
2. Set a search operator for a field
lt operator is applied to a score_value custom field.curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/data/ScoreTable.json?score_value[lt]=1000
3. As a result, the API returns records filtered upon the request.
score_value less than 1000 are returned.{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"items": [
{
"_id": "5d866a5aa0eb4753fc6099c3",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
10,
11,
12,
13
],
"created_at": 1569090138,
"date": "2019-09-21T21:21:00Z",
"expert_mode": false,
"game_mode_name": "beta testing4",
"progress": 0.12,
"score_value": 665,
"updated_at": 1569177165,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.13,
45.52
]
}
]
}
Group records with API key
Group records with API key
1. Use 'Authorization' header to pass API key
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/data/ScoreTable.json?score_value[calc]=avg&group_by=game_mode_name
2. Set an aggregation operator for a field to calculate an average for all numeric values
calc aggregation operator is applied to the score_value and set to the avg value.curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/data/ScoreTable.json?score_value[calc]=avg&group_by=game_mode_name
3. Set an aggregation operator for a field to group records
game_mode_name field.curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
https://api.quickblox.com/data/ScoreTable.json?score_value[calc]=avg&group_by=game_mode_name
4. As a result, the API returns records grouped according to the request.
gamed_mode_name field with an average calculated for the score_value field.{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"items": [
{
"game_mode_name": "4x4",
"avg": 665
},
{
"game_mode_name": "beta testing",
"avg": 2010.5
},
{
"game_mode_name": "team rumble",
"avg": 1211
}
]
}
_id field. It is indexed and will be much faster than the created_at field.score_value[gt]=100&score_value[lt]=1000&game_mode_name[in]=deathmatch,ctf
Search Operators
The request can contain all, some or none of the next search operators:
| Operator | Description |
|---|---|
| lt | Less Than operator Types: integer, float Example: score_value[lt]=1000 |
| lte | Less Than or Equal to operator Types: integer, float Example: score_value[lte]=850 |
| gt | Greater Than operator Types: integer, float Example: bonus_count[gt]=2.45 |
| gte | Greater Than or Equal to operator Types: integer, float Example: bonus_count[gte]=56.443 |
| ne | Not Equal to operator Types: integer, float, string, boolean Example: game_mode_name[ne]=ctf |
| in | Contained IN array operator Types: integer, float, string Example: game_mode_name[in]=deathmatch,rage |
| nin | Not contained IN array operator Types: integer, float, string Example: game_mode_name[nin]=survivor,crazy_nightmare |
| all | ALL contained IN array operator Types: array Example: game_modes[all]=survivor,crazy |
| or | OR 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. |
| ctn | Contains substring operator Types: string Example: username[ctn]=son Will return all records where username field contains son substring. |
| near | Types: 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. |
| Operator | Description |
|---|---|
| sort_asc | Types: all types Example: sort_asc=field_name Search results will be sorted by the specified field in ascending order. |
| sort_desc | Types: all types Example: sort_desc=field_name Search results will be sorted by the specified field in descending order. |
| Operator | Description |
|---|---|
| {field_name}[calc]= | Types: integer, float Example: rating[calc]=min avg, min, max, sum can be used with group_by operator. |
| group_by={field_name} | Types: integer, float, string, boolean Example: group_by=game_mode_name The group_by works similarly to the SQL GROUP BY operator, should be used with the calc operator. |
Path Parameters
Query Parameters
output parameter takes the form of a record with a list of fields for inclusion or exclusion
from the result set. output[include] specifies the fields to include. The _id field is,
by default, included in the result set. To exclude the _id field from the result set, you need
to specify the exclusion of the _id field in the output[exclude] value.output parameter takes the form of a record with a list of fields for inclusion or exclusion
from the result set. output[exclude] specifies the fields to exclude. The _id field is,
by default, included in the result set. To exclude the _id field from the result set, you need
to specify the exclusion of the _id field in the output[exclude] value.Headers
ApiKey {your_api_key}. Must be used
either QB-Token or Authorization.Response
curl -X GET \
-H "Content-Type: application/json" \
-H "QB-Token: 0bea0abd041b2431e5e1c2d0b06fab4414012bba" \
https://api.quickblox.com/data/ScoreTable.json?score_value[lt]=1000
{
"class_name": "ScoreTable",
"skip": 0,
"limit": 100,
"items": [
{
"_id": "5d866a5aa0eb4753fc6099c3",
"_parent_id": null,
"completed_levels": [
1,
2,
3,
10,
11,
12,
13
],
"created_at": 1569090138,
"date": "2019-09-21T21:21:00Z",
"expert_mode": false,
"game_mode_name": "beta testing4",
"progress": 0.12,
"score_value": 665,
"updated_at": 1569177165,
"user_avatar": null,
"user_id": 96753878,
"user_location": [
11.13,
45.52
]
}
]
}
Was this page helpful?