Recipes
Filter records by location
Filter records by location
1
1. Set a search operator for a field
Apply a search operator to the query. Here, the
near
operator is applied to a user_location
field.2
2. As a result, the API returns records filtered by the specified location.
All records with the
11.00,45.40;16800
value for the user_location
field are turned.Filter records by criteria
Filter records by criteria
1
1. Set a search operator for a field
Apply a search operator to the query. Here, the
lt
operator is applied to a score_value
custom field.2
2. As a result, the API returns records filtered upon the request.
All records with the
score_value
less than 1000
are returned.Group records
Group records
1
1. Set an aggregation operator for a field to calculate an average for all numeric values
Apply an aggregation operator for a field to calculate an average for all numeric values.Here, the
calc
aggregation operator is applied to the score_value
and set to the avg value.2
2. Set an aggregation operator for a field to group records
Apply an aggregation operator to a field to group records. Here, a group_by operator is applied to a
game_mode_name
field.3
3. As a result, the API returns records grouped according to the request.
The records are grouped by the
gamed_mode_name
field with an average calculated for the score_value
field.If you are sorting records by time, use the
_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
Custom object class name.
Query Parameters
Search records with the field that contains the specified value. Can be many 1..N.
Search a record with the field that contains a value according to the specified value and operator.
Limit search results to N records. Useful for pagination.
Skip N records in search results. Useful for pagination.
Count search results. Response will contain only count of records found.
Search results will be sorted by specified field in descending order.
Search results will be sorted by specified field in ascending order.
The
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.The
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
A user or application session token. See Authentication page to learn more about session tokens. Must be used either QB-Token or Authorization.