Filtering in queries #
Description #
Basically the filter is passed in requests https://api.apiship.ru/v1/lists/* as a get parameter.
По фильтру можно получить определенную запись по условию из фильтра.
Пример фильтра. Example of a filter, https://api.apiship.ru/v1/lists/points?filter=city=Москва;providerKey=cdek.
With this request, the user will receive the points of the sdek pvz in the city of moscow.
Syntax #
This string filter=city=Москва;providerKey=cdek нis called a filter, what is contained inside the filter is called a condition[s]. For example, this filter contains the conditions city=Moscow and providerKey=cdek.
The condition consists of 3 sections: key, operator, and value. Thus, the condition ’ city=Moscow` can be divided into sections:
- Ключ -
city - Оператор -
= - Значение -
Moscow
Уach following condition must be concatenated to the filter via the ‘;’ separator. Such a filter is valid filter=city=Москва;providerKey=cdek, and such is not filter=city=Москва;providerKey=cdek;.
Table of available values:
| Type | Example | Note |
|---|---|---|
| Array | [one,two,three] | If the array has more than 1 value, only the ’ = ’ operator can be used. Inside the array, the separator is ,. |
| String | one'one'"one" | As a value, String can be enclosed in quotation marks ' or ". |
| Number | 00.1 |
Table of available operators:
| Operator | Available types | DEscription |
|---|---|---|
= | Array, String, Number | |
> | Number, String | |
< | Number, String | |
% | Number, String | Search by parts. The operator works like “%value% " in SQL |
Realisation example #
| |