Sugar Network/API: Difference between revisions
| Line 39: | Line 39: | ||
{{:Sugar_Network/Resources}} | {{:Sugar_Network/Resources}} | ||
== Nodes == | |||
This is an API provided by Sugar Network nodes. | |||
=== Authentication === | === Authentication === | ||
| Line 137: | Line 141: | ||
* raw data or redirection for BLOB properties. | * raw data or redirection for BLOB properties. | ||
<div id=" | === Aggregated properties === | ||
[[Sugar_Network/Resources#Property_types|Aggregated]] properties have special API to treat their content. | |||
<div id="POST-aggproperty"></div> | |||
'''POST''' /''RESOURCE''/''GUID''/''PROP'' | |||
Submit new item. The command returns an id for newly created aggregated item. Depending on particular property, new items might be created not only by object's authors. | |||
<div id="PUT-aggproperty"></div> | |||
'''PUT''' /''RESOURCE''/''GUID''/''PROP''/''ID'' | |||
Update existing aggregated item. Depending on particular property, the command is allowed either to object's authors or to aggregated item submitter. | |||
<div id="DELETE-aggproperty"></div> | |||
'''DELETE''' /''RESOURCE''/''GUID''/''PROP''/''ID'' | |||
Delete existing aggregated item. Depending on particular property, the command is allowed either to object's authors or to aggregated item submitter. | |||
=== Download releases === | |||
To easy download Context [[Sugar_Network/Resources#context-releases|releases]] and avoid reading raw ''Context.releases'' property, there are special high-level API commands. | |||
<div id="GET-solve"></div> | |||
'''GET''' /context/''GUID''?cmd='''solve'''[&requires=''DEPENDENCY''][&lsb_id=''LSB_ID''][&lsb_release=''LSB_RELEASE''] | |||
The command returns information about what particular releases should be downloaded depending on provided requirements. This command might return not only one release, e.g., activities might have dependencies either system packages or another Sugar Network Contexts. | |||
Solving requirements might be: | |||
* {{Code|DEPENDENCY}}, solved release should conform the specified [[Sugar_Network/Recipe_Specification#Dependencies|dependencies]]; the argument might be multiple; | |||
* {{Code|LSB_ID}}, if Context releases depend on system packages, specify the [[Wikipedia:Linux_Standard_Base|LSB]] distributor id to consider while choosing particular packages; | |||
* {{Code|LSB_RELEASE}}, if Context releases depend on system packages, specify the [[Wikipedia:Linux_Standard_Base|LSB]] release number of the distribution to consider while choosing particular packages. | |||
The resulting info is a JSON object with keys equal to Context guids and value objects for chosen release with the following keys: | |||
* {{Code|blob}}, bundle [[Sugar_Network/Resources#Property_types|digest]] to download; | |||
* {{Code|version}}, chosen version number; | |||
* {{Code|title}}, the ''Context.title'' value; | |||
* {{Code|command}}, a command to launch the bundle, only for Sugar activities. | |||
<div id="GET-solve"></div> | |||
'''GET''' /context/''GUID''?cmd='''clone'''[&requires=''DEPENDENCY''][&lsb_id=''LSB_ID''][&lsb_release=''LSB_RELEASE''] | |||
Like the [[#GET-solve|solve]] command, ''clone'' makes a solution but returns bundle itself, i.e., it ignores possible dependencies. | |||
=== Upload | === Upload releases === | ||
To easy upload Context [[Sugar_Network/Resources#context-releases|releases]] and avoid writing to raw ''Context.releases'' property, there is a special high-level API command. | |||
'''POST''' / | '''POST''' /context?cmd='''submit'''[&''PROP''=''VALUE''][&initial] | ||
Where the {{Code|PROP}} arguments are optional | Where the {{Code|PROP}} arguments are optional release properties. The {{Code|initial}} argument asks the system to create new Context resource new release will belong to. | ||
The posting data might be two types, | The posting data might be two types, | ||
| Line 168: | Line 204: | ||
* Sugar activities in .xo bundles,<br>there is no need in {{Code|PROP}} arguments, all properties will be populated basing on metadata from a .xo bundle; including release notes from the {{Code|CHANGELOG}} file in [[Wikipedia:Markdown|Markdown]] notation; besides, only in this case {{Code|initial}} makes sense because it is the only way to get Context properties; | * Sugar activities in .xo bundles,<br>there is no need in {{Code|PROP}} arguments, all properties will be populated basing on metadata from a .xo bundle; including release notes from the {{Code|CHANGELOG}} file in [[Wikipedia:Markdown|Markdown]] notation; besides, only in this case {{Code|initial}} makes sense because it is the only way to get Context properties; | ||
* Arbitrary data,<br>all required | * Arbitrary data,<br>all required release properties should be specified in {{Code|PROP}} arguments, at least ''context'' and ''version''; ''license'' should be specified only if there are no existing releases to pickup license from. | ||
=== Notifications === | === Notifications === | ||