Sugar Network/API: Difference between revisions
No edit summary |
|||
| Line 97: | Line 97: | ||
Data to receive: | Data to receive: | ||
:* property value in JSON notation. | :* property value in JSON notation. | ||
=== Notifications === | |||
It is possible to subscribe to server events. Notification will happen using HTML5 [[wikipedia:Server-sent_events|Server-sent events]]. | |||
To start subscription, send the following request: | |||
'''GET''' /?cmd='''subscribe'''[&only_commits=1] | |||
Where: | |||
* {{Code|only_commits}},<br>subscribers can be notified only with ''commit'' events; that is useful to minimize interactions between server and clients. | |||
Response will be served with ''text/event-stream'' MIME type for default SSE message type. SSE message will be a JSONified object with the following, at least, attributes: | |||
* {{Code|event}}<br>event type. | |||
=== Usage statistics === | === Usage statistics === | ||
| Line 113: | Line 128: | ||
* {{Code|values}} an array of {{Code|timestamp, row}} tuples when {{Code|row}} is a dictionary of database field names and values. | * {{Code|values}} an array of {{Code|timestamp, row}} tuples when {{Code|row}} is a dictionary of database field names and values. | ||
=== | === GNU/Linux packages meta database === | ||
There is a special Project resource, ''Packages''. This project is intended to support a metadata ''database'' for all GNU/Linux packages that are being used as dependencies for activities Sugar Network provides. | |||
Every entry in the ''Packages'' project is a map of native package names to a particular GNU/Linux distribution. So, activities mention only ''Packages'' entry name as a dependency. Afterwards, on a client side, a ''Packages'' entry name will be resolved to a package name according to the local distribution and it will be passed to the PackageKit to install corresponding dependency. | |||
''Packages'' project might be considered as a temporal solution when, and if, [http://distributions.freedesktop.org/wiki/AppStream/MetadataNotes AppStream's MetadataNotes] will be reused in the future. | |||
== Additional resources == | == Additional resources == | ||
| Line 147: | Line 155: | ||
* {{Code|PACKAGE}}<br>a name of the particular package. | * {{Code|PACKAGE}}<br>a name of the particular package. | ||
[[ | Using [[#GNU/Linux packages meta database|Packages]]'s metadata, [[Sugar Network]] will automatically generate dependency graphs for packagekit-backend-presolve. | ||
== Local resources == | == Local resources == | ||