Along with building a prototype for the moisture sensor, I needed to get some kind of prototype endpoint up and running for dumping the data into. I had always intended this to be a restful interface, but I didn’t know the quickest way of building one. I’d looked at services such as thingspeak.com/ and data.sparkfun.com but I felt that I should be laying the foundations here for something that I’d be building on later. Ultimately, the server side system will be a Node or Ruby app, but I don’t have time to build that right now, I needed a shortcut.
A quick bit of googling brought me to ArrestDB which was very easy to set up and gave me a fantastically easy endpoint to push data into. It sits on top of PHP and Mysql (just like something else) so I I dropped it onto my existing VPS. As the data grows it will need a server of it’s own, but we arn’t there yet. The only thing about ArrestDB that troubles me is that there is no security out of the box (other than the obvious care you took creating a MySQL user with only the permissions your app needs on the DB it’s going to use), anyone can connect to your endpoint and start spamming/scraping it. I’m planning on adding in a simple secret token to the flow which should stop 90% of naughtiness occurring.
http://example.com/mytest/things_id/iot_test3_10min?limit=5000&by=id&order=desc
[ {
"id": "6021",
"ts": "2015-05-29 15:48:03",
"thing_id": "iot_test3_10min",
"value": "769"
},
{
"id": "6020",
"ts": "2015-05-29 15:47:52",
"thing_id": "iot_test3_10min",
"value": "771"
},
{
"id": "6019",
"ts": "2015-05-29 15:47:41",
"thing_id": "iot_test3_10min",
"value": "769"
},
]
For now, ArrestDB scores 7/10 on my list of cool things I downloaded from github this week.