-
Notifications
You must be signed in to change notification settings - Fork 123
Query API
temas edited this page Jul 7, 2011
·
2 revisions
This does not reflect what is currently implemented in the core, rather initial design discussions.
/list?{params}
params:
type=x
subtype=x
type spec:
the name of a type; incompatible with a subtype param in the same query
returns the subtypes available in that type
subtype spec:
the name of a subtype; incompatible with a type param in the same query
returns the types that are available for that subtype
/fields?{params}
params:
type/subtype
type/subtype spec:
either type or full type/subtype name
returns the list of indexed fields available on records within that type or type/subtype
/via?{params} # RENAME
params:
id
id spec:
id of a record
returns a list of all objects composed from that record (traversing the via chain upward)
/get{type}?{params}
params:
id=x
time=[]
subtypes=[]
terms=[]
limit=x
offset=x
id spec:
optional
id of a record, if known
time spec:
optional
array of one or two time values
if only one value, it is a simple filter; if two values, it is a range filter
subtypes spec:
optional
array of subtypes (implicit OR)
filters to just the subtypes passed in the array
terms spec:
required
array of json-style key-value pairs
allows dot-notation for addressing nested document fields
all terms are evaluated with an implicit boolean AND; boolean OR evaluations must be explicitly declared
OPERATORS:
+ greater than; post-pended on a value (ie, 25+ is equivalent to 'greater than 25')
- less than; post-pended on a value (is 25- is equivalent to 'less than 25')
+. greater than or equal to; post-pended on a value (ie, 25+. is equivalent to 'greater than or equal to 25')
-. less than or equal to; post-pended on a value (ie, 25-. is equivalent to 'less than or equal to 25')
OR boolean OR
!= not equal to
COUNT returns the count of the nested query (ie, COUNT(name:'Thomas' , age:25+.) would return the number of people whose name is Thomas and who are 25 or older)
limit spec:
optional
defines a max number of results to return for a query
offset spec:
optional
defines an offset into the query results; can be paired with limit to provide paging
- get all emails to [email protected] from [email protected] or [email protected] with the tag 'singly'
/getMessages?subtypes=[IMAP]&terms=[to:'[email protected]', (from:'[email protected]' OR from:'[email protected]'), tag:'singly']
- get all photos tagged Jason Cavnar or Jeremie Miller which are labeled with the event name 'Hashable Party'
/getPhotos?terms=[(tagged:'Jason Cavnar' OR tagged:'Jeremie Miller'), event:'Hashable Party']
- get all contacts who are 21 or older in the state of California who have 'node.js' in their bio
/getContacts?terms=[age:21+., address.state:'CA', bio:'node.js']&limit=30