This exposes datas via a REST interface. The following should apply to all resources:
All resources support the JSON-P protocol by appending the
callback
parameter to the URL:
/v1/foobar?callback=my_handler
You may add debug=true
to enable debugging information. This can
give you a hint of what went wrong:
/v1/foobar?debug=true
2xx: | Ok; |
---|---|
4xx: | Client error; |
5xx: | Server error; |
200: | Success; |
201: | Created; |
404: | The requested data could not be found [invalid range, missing event etc.]; |
400: | You did something wrong; |
500: | Internal server error; |
They will always come using the following format:
{"status": int, "reason": string}
status: | the http response code [e.g. 404, 500]; |
---|---|
reason: | a very short description of what went wrong [might not be that useful though, use debug=true for more context]; |
GET
¶Retrieves all events/data withing a given month.
status: |
|
---|---|
query string: |
|
GET
¶Retrieves all events/data withing a given day.
status: |
|
---|---|
query string: |
|
GET
¶Retrieves data/events from the past 24 hours.
status: |
|
---|---|
query string: |
|
GET
¶Retrieves data/events from the past week.
status: |
|
---|---|
query string: |
|
GET
¶Retrieves data/events within a given time range.
status: |
|
---|---|
query string: |
|
TIMESPEC uses the the following strftime format:
%Y%m%dT%H%M
Example:
$ curl {endpoint}/v1/foobar?start=20120101T1430&finish=20120101T1500
{ "status": 200,
"results": ...
}
POST
¶Inserts a new metric under this key. The body of the request must be a valid json and the json must have the following keys:
status: |
|
---|---|
parameters: |
|
You may also provide a list of metrics as long as theirs names match the on given on the URL.
Examples:
$ curl -X POST -d '{"type": "gauge", "value": 0.2}' {endpoint}/v1/foobar
{"status": 201,
"results": [{"name": "foobar", "timestamp": 1366549812, "type": "gauge", "value": 0.2}]
}
PUT
¶Deprecated: use /POST/
POST
¶Inserts a new data value under this key. The body of the request must be a valid json, and the json must have the following keys:
status: |
|
---|---|
parameters: |
|
You may use this resource to store up to 8k bytes worth of data [in
the value
field]. You may also provide a list of values [as long
as theirs names match the one given on the URL] in which case each
item of the list is subject to this limit.
Example:
$ curl -X POST -d '{"value": :VALUE, "timestamp": 1352483918}' {endpoint}/v1/data/foobar
{ "status": 201,
"results": [{"name": "foobar", "timestamp": 1352483918, "value": :VALUE}]
}