Export Data to Remote Website

We are developing a web-based app to provide device configuration and data analysis (graphs, analytics, etc.) to end users with Imp-enabled devices. I am having difficulty finding how to transfer the data from the Imp cloud to a remote database. I would preferably like to push the data as it comes in, or periodically, but pulling is acceptable (at least for now). It is also acceptable, at least for now and depending on the volume of data, to post it directly to the remote database (likely Mongo).

What is the best way to do this? Are there any samples out there?

Thanks!

I have mine going to a website page that is putting it in to MySQL. Perhaps this helps you.

Agent Code:
`function httpPostInsert(data, url) {
server.log(data);
local request = http.post(url, {“Content-Type”: “application/x-www-form-urlencoded”}, data)
local response = request.sendsync();
return response;
}

device.on(“logData”, function(data) {
local response = httpPostInsert(data, “https://youwebsite.com” );
server.log("response body: " + response.body);
});`

Device Code:
agent.send("logData",str);

You can’t create a direct connection from an imp to a database - you’ll need to wrap your DB with an API of some kind, then make web requests to store/retrieve data.

Thanks. I was planning to put up a web page end-point and have either the imp-cloud or the agent call it. Guess I’ll just have the agent post directly.