Searching resources is performed in URL. The filtering is always composed by URL segment that defines column to filter on and next URL segment that is value. Here's an example of a URL that uses all filtering options
- String use urlencoding in case of non-ascii characters
- Number use integers or float with "." (dot) for decimal separator
- Date use ISO format (YYYY-MM-DD)
Datetime use ISO formats
- YYYY-MM-DD hhss
- YYYY-MM-DD hhss.uuuuuu
YYYY - four digit year e.g. 2018
MM - two digit month e.g. 12
DD - two digit day e.g. 31
hh - two digit hour e.g. 23
mm - two digit minute e.g. 59
ss - two digit second e.g. 59
uuuuuu - six digit microsecond e.g. 999999
The simplest filtering is by exact comparison.
https://demo.slashdb.com/db/Chinook/Customer/Country/USA - get Customers from USA
You can separate values with "," (comma) to compare with multiple values. This effectively works like an "or".
https://demo.slashdb.com/db/Chinook/Customer/Country/USA,Canada - get Customers from USA or Canada
You can combine filtering on multiple columns which effectively works like and "and". You can combine as many, as you need.
https://demo.slashdb.com/db/Chinook/Customer/Country/USA/City/New York - get Customers from New York, USA.
Negation can be applied to any filter (i.e. exact value, substring, etc.) to obtain records other than the ones matching the given filter. Prefix the filtered field with the ~ (tilde) character to invert the filtering condition for that field.
https://demo.slashdb.com/db/Chinook/Customer/~Country/USA - get Customers from anywhere except the USA.
https://demo.slashdb.com/db/Chinook/Customer/~Country/USA,Canada - get Customers from anywhere except the USA or Canada.
https://demo.slashdb.com/db/Chinook/Track/~TrackId/1..3495 - get Tracks with TrackId outside of the range of 1 to 3495.
Search by Substring
It's also possible to search by matching substring. In general "*" (asterisk) means any characters. It's also possible to search asterisk literally but then you need to override default wildcard character.
/[column_name]/[starts_with_string]* /[column_name]/*[ends_with_string] /[column_name]/[starts_with_string]*[ends_with_string] /[column_name]/*[contains_string]*
https://demo.slashdb.com/db/Chinook/Customer/LastName/M* - get only Customer with LastName starting with letter M
https://demo.slashdb.com/db/Chinook/Customer/LastName/M*r - get only Customer with LastName starting with letter "M" and ending with letter "r".
https://demo.slashdb.com/db/Chinook/Customer/City/*ar* - get only Customers from Cities that have "ar" somewhere in their name.
Search by Ranges
For numeric values (integer, float, date) can filter by a range.
- Greater or equal
- Less or equal
/[column_name]/[value].. /[column_name]/..[value_to] /[column_name]/[value_from]..[value_to]
https://demo.slashdb.com/db/Chinook/Invoice/Total/9.91.. - get Invoices of Total value ≥ 9.91
https://demo.slashdb.com/db/Chinook/Invoice/Total/..1.98 - get Invoices of Total value ≤ 1.98
https://demo.slashdb.com/db/Chinook/Invoice/CustomerId/1..5.html - get Invoices of Customer with CustomerId between 1 and 5.