Jump to: navigation, search

Sugar Network/API

51 bytes removed, 21:09, 17 March 2014
Client proxy
The reasons to proxy Sugar Network data on users side:
* Seamless support [[#Offline casemode|offline workflow]];
* [[#Launching|One-click launch]] Sugar activities hosted on Sugar Network.
[[Platform_Team/Sugar_Network/Implementation#sugar-network-client|local process]] launched beforehand.
=== Offline case mode ===
Being connected to a Sugar Network server, local proxy provides original Sugar Network content. If the connection is lost, the proxy will switch to local Sugar Network storage and continue working. Any content created in offline mode will be uploaded to the server after getting a connection back.
Besides, local Sugar Network storage will be reused to keep users preferences, such as:
* '''favorite''' contextsFavorited Contexts<br>to select preferred ''Context'' resources; these contexts Contexts will be marked by {{Code|favorite}} value in the ''Context.layer'' property;
* '''cloned''' contextsChecked-in Contexts<br>to keep most recent context Context (for ''activity'' and ''Implementationbook'' types) version in local storage to make it available in offline; note that there is no need in cloning checking-in to speedup online lunch, ''Implementations'' versions are being [[#Launching|cached]] anyway; these contexts Contexts will be marked by {{Code|clonecheckin}} value in the ''Context.layer'' property.
To control users preferences there are special API commands:
'''PUT''' /context/''GUID''?cmd='''favorite'''
Change favorite status. {{Code|PUT}} content should be Set favorite status.
<div id="PUT_cloneDELETE_favorite"></div>
'''PUTDELETE''' /context/''GUID''?cmd='''clonefavorite'''[&spawn]
Change cloning Unset favorite status for . <div id="PUT_checkin"></div>  '''PUT''' /context/''GUID''?cmd='''checkin'''[&spawn] Check-in the specified context. {{Code|PUT}} content should be cloning statusContext. By default, the command will return streamed ''text/event-stream'' MIME type data to monitor the whole cloning processprogress. If the {{Code|spawn}} argument is specified, the command will exit immediately with [[#Notifications|asynchronous sending]] cloning progress events. <div id="DELETE_checkin"></div>  '''DELETE''' /context/''GUID''?cmd='''checkin''' Checkout the Context.
=== Launching ===
Sugar Network Contexts (for ''activity'' and ''Contextsbook'' types) can be launched as-is. The launching process is implicit and includes selecting the most recent (and appropriate for software contexts) ''Implementation''version, downloading bundles from the Sugar Network, installing missed [[Sugar_Network/Recipe_Specification#Dependencies|software dependencies]], executionitself. All downloaded implementations bundles will be cached [with further garbage collecting] to speedup further launching.
Sugar activities (with {{Code|activity}} value in the ''Context.type'' property) will be directly executed. Non-software contexts Book Contexts will be opened in the proper application according to its ''Implementation.mime_type''MIME type.
'''GET''' /context/''GUID''?cmd='''launch'''[&args=''ARG''][&activity_id=''ACTIVITY_ID''][&object_id=''OBJECT_ID''][&uri=''URI''][&contextapp=''CONTEXTAPP''][&spawn]
Arguments that make sense only for Sugar activities:
* {{Code|URI}}, URL to resume if activity supports this functionality.
Arguments that make sense only for non-software contextsbooks:
* {{Code|CONTEXTAPP}}, specify application ''Context'' to open the launching implementation book by; if omitted, the system will try to find most appropriate option, among all existing software contexts, using ''Context.mime_types'' propertyContexts.
Common arguments:

Navigation menu