Sugar Network/API: Difference between revisions

Line 22: Line 22:


== Objects ==
== Objects ==
The common ''COMMAND''s are:
/'''create'''
Create new ''OBJECT'' item.
Inputs:
:* {{Code|ctime}} ''int'', the UNIX seconds time of entry creation; optional, will be set on a server side otherwise;
:* {{Code|mtime}} ''int'', the UNIX seconds time of entry modification; optional, will be set on a server side otherwise;
Returns:
:* {{Code|guid}} ''str'', globally unique identifier that specifies created item;
/'''update'''?guid=<>
Modify the specified item.
Inputs:
: Keys that need to be modified.
/'''delete'''?guid=<>
Delete the specified item. The real destroying won't happen, the item will be hidden. The garbage collection of hidden items will be processed by Network administrators.
/'''find'''?[query=<>][&offset=<>][&limit=<>][&properties=<PROP>[,..]][&order_by=<[<nowiki>[+|-]</nowiki><PROP>[,..]]
Find items.
Where:
:* {{Code|query}} ''str'', search request in [http://xapian.org/docs/queryparser.html Xapian] notation;
:* {{Code|offset}} ''int'', start index to return entries from;
:* {{Code|limit}} ''int'', do not return more then specified value;
:* {{Code|properties}} ''str'', coma separated list of ''OBJECT'' properties to return; by default, return all properties;
:* {{Code|order_by}} ''str'', coma separated list of ''OBJECT'' properties to sort the resulting list; if an property starts with the {{Code|-}}, the order is descending, otherwise it is ascending;
Inputs:
:* A dictionary with ''OBJECT'''s properties to restrict the resulting list.
Returns:
:* An array of dictionaries with ''OBJECT'' properties, dictionaries contain at least {{Code|guid}} property.
/'''get'''?guid=<>[&properties=<PROP>[,..]]
Return properties the of particular item.
Where:
:* {{Code|properties}} ''str'', coma separated list of ''OBJECT'' properties to return; by default, return all properties.
Returns:
:* A dictionary with ''OBJECT'' properties that contains at least {{Code|guid}} property.


=== Player ===
=== Player ===