Parse.com works great with Electric Imp

As part of the process of developing a little device that displays weather, news, twitter and other things, all defined by the user, I built a complete backend (on AWS) with sign-up and login functionality. Then I started to move the web based admin to a bespoke iOS app using the Electric Imp SDK so the settings and Blink Up are all in one.

Anyway it was then that I discovered Parse.com to handle all the backend stuff and all the iOS stuff. Within a very short time I had a fully working sign-up and login functionality inside the app (replacing my own version) which also handles all the settings for that user plus I reworked all the backend HTTP request code (previously bits of PHP) to be handled by Parse.com via their Cloud Code. When I say a short time I’m talking a day!

The docs are also very impressive. The only downside (for some) is that Parse.com is owned by Facebook, but with functionality this good it’s kind of hard to ignore.

Just wanted to mention it in case some of you aren’t aware of it as service.

Do you have a parse.com class or some example code you would be willing to share? (Perhaps similar to the Firebase Example by electric imp?)

Sure!

This is some Cloud Code that queries the database for the setting for clock, set by the user in the iPhone app.

`Parse.Cloud.define(“clock”, function(request, response) {
var query = new Parse.Query(“Settings”);
query.equalTo(“objectId”, request.params.objectId);
query.first({
success: function(results) {

  response.success(results.get('clock'));
},
error: function() {
  response.error("lookup failed");
}

});
});`

I’m passing in the objectID but for real-world deployment this would most likely be the deviceID, that would be set on blink-up and stored when the user signs-up to your app.

Then the agent code is pretty standard:

local parse = http.post("https://api.parse.com/1/functions/clock",{"X-Parse-Application-Id":"APP_ID_GOES_HERE","X-Parse-REST-API-Key":"APP_KEY_GOES_HERE","Content-Type":"application/json"},"{\"objectId\":\"SoFyvTPBNZ\"}").sendasync(function(parse) { server.log("Raw JSON from parse.com: "+parse.body); local decodedJSON = http.jsondecode(parse.body); server.log(decodedJSON.result); });

For the iPhone app, Parse.com has stuff on their site to show how you to do all that side.

Hope that helps.

I’ve been reading the parse.com Docs and Tutorials. This is easy to use? How long did it take to install? Can you show us a simple app? Iphone and Imp?