Sugar Network/API: Difference between revisions

No edit summary
Line 193: Line 193:
* {{Code|records}}, number of stat records to return for the {{Code|start}}-{{Code|end}} interval; note that this amount is not precise, the final resultset might be smaller or bigger depending on chosen resolution; stats resolution depends on node configuration, default values are 1 day, 10 days, 30 days, 366 days;
* {{Code|records}}, number of stat records to return for the {{Code|start}}-{{Code|end}} interval; note that this amount is not precise, the final resultset might be smaller or bigger depending on chosen resolution; stats resolution depends on node configuration, default values are 1 day, 10 days, 30 days, 366 days;
* {{Code|source}}, multiple argument to specify what [[Sugar_Network/Node_Statistics#Common_statistics|stats]] should be returned.
* {{Code|source}}, multiple argument to specify what [[Sugar_Network/Node_Statistics#Common_statistics|stats]] should be returned.
=== Usage statistics ===
In order to collect [[Platform_Team/Usage_Statistics|usage statistics]] gathered in local users' environment by [[Platform_Team/sugar-stats|sugar-stats]] library based applications, the API provides related commands for ''User'' [[Sugar Network]] resource.
'''GET''' /user/''GUID''?cmd='''stats-info'''
Returns a dictionary with RRD configuration settings for local stats collecting process that user side should use to avoid problems while uploading stats to the server.
'''POST''' /user/''GUID''?cmd='''stats-upload'''
Upload statistics. Request content should be in JSON notation and be a dictionary of:
* {{Code|name}} name of RRD database to upload stats to;
* {{Code|values}} an array of {{Code|timestamp, row}} tuples when {{Code|row}} is a dictionary of database field names and values.


== Client proxy ==
== Client proxy ==