Sugar Network/API: Difference between revisions
mNo edit summary |
|||
| Line 198: | Line 198: | ||
The reasons to proxy Sugar Network data on users side: | The reasons to proxy Sugar Network data on users side: | ||
* Seamless support [[#Offline | * Seamless support [[#Offline mode|offline workflow]]; | ||
* [[#Launching|One-click launch]] Sugar activities hosted on Sugar Network. | * [[#Launching|One-click launch]] Sugar activities hosted on Sugar Network. | ||
| Line 204: | Line 204: | ||
[[Platform_Team/Sugar_Network/Implementation#sugar-network-client|local process]] launched beforehand. | [[Platform_Team/Sugar_Network/Implementation#sugar-network-client|local process]] launched beforehand. | ||
=== Offline | === Offline 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. | 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. | ||
| Line 210: | Line 210: | ||
Besides, local Sugar Network storage will be reused to keep users preferences, such as: | Besides, local Sugar Network storage will be reused to keep users preferences, such as: | ||
* | * Favorited Contexts<br>to select preferred ''Context'' resources; these Contexts will be marked by {{Code|favorite}} value in the ''Context.layer'' property; | ||
* | * Checked-in Contexts<br>to keep most recent Context (for ''activity'' and ''book'' types) version in local storage to make it available in offline; note that there is no need in checking-in to speedup online lunch, versions are being [[#Launching|cached]] anyway; these Contexts will be marked by {{Code|checkin}} value in the ''Context.layer'' property. | ||
To control users preferences there are special API commands: | To control users preferences there are special API commands: | ||
| Line 220: | Line 220: | ||
'''PUT''' /context/''GUID''?cmd='''favorite''' | '''PUT''' /context/''GUID''?cmd='''favorite''' | ||
Set favorite status. | |||
<div id=" | <div id="DELETE_favorite"></div> | ||
''' | '''DELETE''' /context/''GUID''?cmd='''favorite''' | ||
Unset favorite status. | |||
<div id="PUT_checkin"></div> | |||
'''PUT''' /context/''GUID''?cmd='''checkin'''[&spawn] | |||
Check-in the specified Context. By default, the command will return streamed ''text/event-stream'' MIME type data to monitor the progress. If the {{Code|spawn}} argument is specified, the command will exit immediately with [[#Notifications|asynchronous sending]] progress events. | |||
<div id="DELETE_checkin"></div> | |||
'''DELETE''' /context/''GUID''?cmd='''checkin''' | |||
Checkout the Context. | |||
=== Launching === | === Launching === | ||
Sugar Network '' | Sugar Network Contexts (for ''activity'' and ''book'' types) can be launched as-is. The launching process is implicit and includes selecting the most recent (and appropriate for software contexts) version, downloading bundles from the Sugar Network, installing missed [[Sugar_Network/Recipe_Specification#Dependencies|software dependencies]], execution itself. All downloaded bundles will be cached [with further garbage collecting] to speedup further launching. | ||
Sugar activities | Sugar activities will be directly executed. Book Contexts will be opened in the proper application according to its MIME type. | ||
'''GET''' /context/''GUID''?cmd='''launch'''[&args=''ARG''][&activity_id=''ACTIVITY_ID''][&object_id=''OBJECT_ID''][&uri=''URI''][& | '''GET''' /context/''GUID''?cmd='''launch'''[&args=''ARG''][&activity_id=''ACTIVITY_ID''][&object_id=''OBJECT_ID''][&uri=''URI''][&app=''APP''][&spawn] | ||
Arguments that make sense only for Sugar activities: | Arguments that make sense only for Sugar activities: | ||
| Line 243: | Line 255: | ||
* {{Code|URI}}, URL to resume if activity supports this functionality. | * {{Code|URI}}, URL to resume if activity supports this functionality. | ||
Arguments that make sense only for | Arguments that make sense only for books: | ||
* {{Code| | * {{Code|APP}}, specify application Context to open the book by; if omitted, the system will try to find most appropriate option, among all existing software Contexts. | ||
Common arguments: | Common arguments: | ||