Skip to content

Latest commit

 

History

History
96 lines (93 loc) · 2.09 KB

API.md

File metadata and controls

96 lines (93 loc) · 2.09 KB

Create series class

curl -X 'PUT' -u 'id:secret' \
	https://us0.eventdb.io/<your_id>/house/ \
	-d '{"index" : [
	    {"/electricity" : "sum"}, 
	    {"/temperature" : ["avg", "max"]}
	]}'

Data series with same class shares same index set and policies

Fill series with data

curl -X 'POST' -u 'id:secret' \
	https://us0.eventdb.io/<your_id>/house/alice/ \
	-d '{"electricity" : 15, "temperature" : 20}'

... or provide your own timestamps

curl -X 'PUT' -u 'id:secret' \
	https://us0.eventdb.io/<your_id>/house/alice/2015.01.30T02:00:00.0000 \
	-d '{"electricity" : 15, "temperature" : 20}'

Query aggregated data

curl -X 'POST' -u 'id:secret' \
	https://us0.eventdb.io/<your_id>/house/alice/ \
	-d '{"$from" : "2015.01.30T02:00:00",
	    "$to" : "2015.01.30T03:00:00",
	    "/electricity" : "sum",
	    "/temperature" : "avg"}'
{
    "/electricity" : 15,
    "/temperature" : 20
}

... and group it

curl -X 'POST' -u 'id:secret' \
	https://us0.eventdb.io/<your_id>/house/alice/ \
	-d '{"$from" : "2015.01.30T02:00:00",
	    "$to" : "2015.01.30T03:00:00",
	    "$group" : "1h"
	    "/electricity" : "sum",
	    "/temperature" : "avg"}'
{
    "2015.01.30T02:00:00": {
        "/electricity" : 15,
        "/temperature" : 20
    }
}

... or fetch it as is

curl -u 'id:secret' \
    https://us0.eventdb.io/<your_id>/house/alice/2015.01.30T02:00:00.0000
{
    "electricity" : 15,
    "temperature" : 20
}

... or request range

curl -u 'id:secret' \
https://us0.eventdb.io/<your_id>/house/alice/2015.01.30T02:00:00.0000-2015.01.30T02:00:00.0000
{"2015.01.30T02:00:00.0000": {
    "electricity" : 15,
    "temperature" : 20
}}

Share your data

curl -X 'POST' -u 'id:secret' \
	https://us0.eventdb.io/<your_id>/house/alice/?share=read,write
https://us0.eventdb.io/~jd0xmk8sL

... and use it from client devices

curl -X 'POST' \
	https://us0.eventdb.io/~jd0xmk8sL \
	-d '{"electricity" : 15, "temperature" : 20}'

Questions

  • Region in url?