Requirements:
- One line query through uri.
- Filtering
- Sorting
- Limitation
- Partial fetching
- Fetching linked resources
- Normalized response
- Bulk requests
- Metadata discovery
URI special symbols (encoded by encodeURIComponent
but not encodeURI
): =
, @
, #
, $
, &
, +
, ;
, :
, ,
, /
, ?
.
Common query string format: pairs separated by &
, key and value separated by =
.
Common path format: chunks sparated by /
.
:
can't be used in first chunk of path. Repeated ?
and #
may be escaped by some libs.
So mostly safe symbols: =
, @
, $
, &
, +
, ;
, ,
, /
.
Symbols that can be used in the path in any place, escaped by encodURIComponent, but not escaped by ChromeDev Tools: /
, @
, $
, &
, +
, =
, [
, ]
, ;
, ,
.
Examples:
/
- metadata of all types/user=jin[name][age]
- name and age of user by primary key/user[sex=male,female][age=&18,18,40&50,100&][role!=admin]
- sex and age of users by filter:male
orfemale
but nottrans
, and not admin, with age <18, age = 18, 40 < age < 50, age > 100/user[+birthday=2000-01-01&][-created][&10]
- 10 users with birthday from2000-01-01
sorted by birthday asc then id desc/user[name][friend[name][age=18&][&10]]
- users with names and 10 friends with names and ages that have age > 18/user=jin[friend[name]],article=hello[liker[name]]
- load all "jin" friend names and "hello" liker names, without users data dublication
Syntax:
- Field name:
user
,article
etc. - Order field predicate:
+
- asc,-
- desc. - Fetch modifier:
[field]
- additinal fetch of this field,[10&20]
- slice part of list - Predicates for filtering:
=
- positive,!=
- negative - Lists:
1,2,3
- Range:
1&5
- between,1&
- greated then,&5
- lower then,3
- only this value