Created
September 23, 2011 01:03
-
-
Save harleyholt/1236511 to your computer and use it in GitHub Desktop.
Example Data API Return Object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* One way of specifying the analytic endpoint data. | |
* In this scheme, we can have multiple parallel time series returned. | |
* Includes a summary object which allows us to return aggregated data for the series. | |
* Includes a meta object which has information about the series (such as the units of measurement). | |
* | |
* The time series is specified as an array of values. This series can not be missing any values because it is in | |
* parallel to the generated time values. The API must take care of filling in any missing values of the time | |
* series before returning it. | |
* | |
* The time values (generally speaking the x values of a graph since all of our metrics are over time) is specified in | |
* the time property. The object includes the start and end time of the graph data and a resolution of the data which tells | |
* the interval between each measurement. The values property holds the actual datetime values of the samples | |
* (the client will use these as the x values) | |
**/ | |
{ | |
site: example.com, | |
time: { | |
start: 1315840500, | |
end: 1316186100, | |
resolution: 'day', | |
values: [1315840500, 1315926900, 1316013300, 1316099700, 1316186100] | |
}, | |
metrics: { | |
happiness: { | |
summaries: { | |
average: 14.2 | |
}, | |
meta: { | |
units: 'beers', | |
title: 'Beers per Day', | |
description: 'The number of beers consumed in a day' | |
}, | |
series: [ 12.4, 32.1, 0.0, 4.4, 19 ] // these are in parallel to the time values and must be combined to be graphed | |
}, | |
rest: { | |
summaries: { | |
average: 6.2 | |
}, | |
meta: { | |
units: 'hours', | |
title: 'Hours of sleep per day', | |
description: 'The number of hours slept per day' | |
}, | |
series: [ 8.3, 3, 4.1, 0.0, 12.4 ] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment