A terrific Cloud-based mobile app builder is Tiggzi from Exadel . Max Katz who heads developer relations will be at the AT&T Education Hackathon this weekend in Palo Alto. MongoLab will be there as well, and I thought that it would be nice to have a demo to show how to get data from a cloud-hosted MongoLab instance into a Tiggzi mobile application. That means you can very quickly build an iOS or Android app, or a Web app, all backed by the leading standard for document storage, MongoDB. For more info about the MongoLab REST API, see this documentation page.
MongoLab includes a REST API protected by SSL and a shared Key that we’ll use to make a query into the Tiggzi project. By using MongoLab, you can have the benefits of simple connectivity through the https REST interface AND the benefits of a high-performance direct client MongoDB driver when needed, say for log searches or social media analytics.
1. Create a MongoLab account and create a new database and collection if you don’t have any yet. (URL: mongolab.com/signup) The REST API provides access at the database, collection, and document level. You’ll be doing a call from the collection level that will return a JSON array of documents.
2. Once you’re in the collection that you want to expose, click on the “Open API View” button to see a formatted version of what the REST call at the collection level would return. (The “View raw JSON” button will show the unformatted data).
3. Right click over the Resource URL and copy it to your clipboard. You’ll notice that it has the properly formed syntax for an entire collection query and includes your apiKey. Separate out the URL up to the query delimiter ‘&’ and also separate out the apiKey query parameter. You’ll paste it into Tiggzi in a bit. (Note you can regenerate a new API key by clicking on your username in the upper right header.)
4. If you don’t have any documents in the collection, add at least two dummy documents.
3. in the “Request Parameters” pane, add four parameters: apiKey, q, l, sk (the last three are useful but optional, they are the JSON query parameter, a document count limiter for pagination, and a skip parameter, again for pagination)
4. Fill in the apiKey value with the one you saved. If your collection is large, you may want to set the limit parameter to something reasonable, say 32. You can optionally add a query to match only documents you want.
7. Save and close this REST Service
You can now wire up the data structure to your mobile app screens as in the Twitter example: http://help.tiggzi.com/getting-started/building-twitter-search-app
Queries and beyond
And for Create, Update, and Delete, you can formulate a dynamic URL with other http verbs (PUT, POST, DELETE) to handle those actions. The Tiggzi documentation for doing that is here. The mapping from the http verbs to MongoLab actions is documented here.
Exadel provides innovative software using the most advanced technologies including mobile, cloud, and rich Web user interfaces. Founded in 1998, Exadel is privately owned with headquarters in the San Francisco Bay Area. Ourglobal network of development offices has grown to include offices in New York, Chicago, Belarus, Russia, and Ukraine.