Sugar Network/API: Difference between revisions
| Line 93: | Line 93: | ||
<div id="GET"></div> | <div id="GET"></div> | ||
'''GET''' /''RESOURCE''[?offset=''INTEGER''][&limit=''INTEGER''][&query=''STRING''][&reply=''PROP'' | '''GET''' /''RESOURCE''[?offset=''INTEGER''][&limit=''INTEGER''][&query=''STRING''][&reply=''PROP''][&order_by=<nowiki>[+|-]</nowiki>''PROP''][&group_by=''PROP''][&''PROP''=''VALUE''][&''!PROP''=''VALUE''] | ||
Find resource objects. | Find resource objects. | ||
Where: | Where: | ||
* {{Code|offset}}, ''int''<br>start index to return entries from; | * {{Code|offset}}, ''int''<br>start index to return entries from, the default value is {{Code|0}}; | ||
* {{Code|limit}}, ''int''<br>do not return more then specified value; | * {{Code|limit}}, ''int''<br>do not return more then specified value, maximal and default values are being setup on server side; | ||
* {{Code|query}}, ''str''<br>search request in [http://xapian.org/docs/queryparser.html Xapian] notation with the following additions: | * {{Code|query}}, ''str''<br>search request in [http://xapian.org/docs/queryparser.html Xapian] notation with the following additions: | ||
** if property is boolean, integer or datetime, it supports searching by ranges: {{Code|''PROP'':[''START'']..[''END'']}}; | ** if property is boolean, integer or datetime, it supports searching by ranges: {{Code|''PROP'':[''START'']..[''END'']}}; | ||
** the statement {{Code|''PROP''<nowiki>:=</nowiki>["]''VALUE''["]}} has the same effect as {{Code|QUERY_PROP}}; it is different to regular {{Code|''PROP'':''VALUE''}} where {{Code|VALUE}} might be a substring; | ** the statement {{Code|''PROP''<nowiki>:=</nowiki>["]''VALUE''["]}} has the same effect as {{Code|QUERY_PROP}}; it is different to regular {{Code|''PROP'':''VALUE''}} where {{Code|VALUE}} might be a substring; | ||
* {{Code| | * {{Code|PROP}}, ''str''<br>supplements {{Code|query}} with filtering by exact value of the {{Code|PROP}} property; the resulting query string will be {{Code|''PROP''<nowiki>=</nowiki>''VALUE'' AND (''QUERY'')}}; argument is multiple; | ||
* {{Code|reply}}, ''str''<br> | * {{Code|!PROP}}, ''str''<br>supplements {{Code|query}} by excluding exact value of the {{Code|PROP}} property; the resulting query string will be {{Code|NOT ''PROP''<nowiki>=</nowiki>''VALUE'' AND (''QUERY'')}}; argument is multiple; | ||
* {{Code|reply}}, ''str''<br>''RESOURCE'' properties to return; by default, return only {{Code|guid}} property; argument is multiple; | |||
* {{Code|order_by}}, ''str''<br>property to sort the resulting list by; if starts with the {{Code|-}}, the order is descending, otherwise it is ascending; | * {{Code|order_by}}, ''str''<br>property to sort the resulting list by; if starts with the {{Code|-}}, the order is descending, otherwise it is ascending; | ||
* {{Code|group_by}}, ''str''<br>property name to group resulting list by. | * {{Code|group_by}}, ''str''<br>property name to group resulting list by. | ||
| Line 114: | Line 115: | ||
<div id="GET-resource"></div> | <div id="GET-resource"></div> | ||
'''GET''' /''RESOURCE''/''GUID''[?reply=''PROP'' | '''GET''' /''RESOURCE''/''GUID''[?reply=''PROP''] | ||
Where: | |||
* {{Code|reply}}, ''str''<br>''RESOURCE'' properties to return; by default, return only {{Code|guid}} property; argument is multiple; | |||
Return properties for a particular resource object. | Return properties for a particular resource object. | ||