App Inventor and the Web component


App Inventor and CouchDBCouchDBTM, a document based database

It was asked in the App Inventor forum how to access CouchDB with App Inventor. From the CouchDB The Definitive Guide website: With its simple model for storing, processing, and accessing data, CouchDB is ideal for web applications that handle huge amounts of loosely structured data. That alone would stretch the limits of a relational database, yet CouchDB offers an open source solution that's reliable, scales easily, and responds quickly.

This basic example follows the Core API to post a document in JSON format to CouchDB and later get it back again from CouchDB.

Note: In this tutorial I played around with an early version of the newblocks version of App Inventor, now called App Inventor. All the blocks required for this example are also available for App Inventor Classic, just adjust the example for App Inventor Classic to your needs. Thank you Jos for the new PUT and DELETE blocks!

You probably also might be interested in the App Inventor - MongoDB and App Inventor - Amazon SimpleDB interfaces.

Preparation

Sign up at iriscouch.com to get your own CouchDB and add that name in App Inventor in variable strCouchDB. Then from the menu in Iris Couch create a database called albums we use for this example. That's all.
Alternatively starting with MIT App Inventor Version 134 you now also can create your database from within App Inventor, see below.


Do you need help with your App Inventor project?

I can help you: for one hour I charge 25 USD.
Please contact me at info [at] puravidaapps [dot] com for details!
For questions about App Inventor, please use the App Inventor forum. Thank you.

Welcome

This one is basic and simple. It can serve as a sanity check to see if CouchDB is running at all.


INSERT

This is the insert example. We will post the following document to CouchDB:

{"title":"There is Nothing Left to Lose","artist":"Foo Fighters"}
      

The POST operation can be used to create a new document with a server generated id. Starting with MIT App Inventor Version 134 alternatively you can use now the new PUT block with your own id.


SELECT

This is the select example. We will get the posted item back from CouchDB.


UPDATE

This is the update example. We will update the posted item in CouchDB.


ADD AN ATTACHMENT

This is to add an attachment to the posted item in CouchDB.


RETRIEVE AN ATTACHMENT

This is to retrieve an attachment from the posted item in CouchDB.


DELETE

This is the delete example. We will delete the posted item in CouchDB.


CREATE DATABASE

This is to create a database in CouchDB.


DELETE DATABASE

This is to delete a database in CouchDB.


Further blocks used




Download


Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!

Donation amount:

or donate some mBTC to Bitcoin Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Bitcoin

Thank you! Taifun
 

The App Inventor version I used for this example was a very early version of App Inventor 2 and is not compatible with the current version. As you can see, some blocks are different, also some of the block colors. I therefore do not provide the project's aia file.

Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.


Home | Snippets | Tutorials | Extensions | News | Forums | Links | Search | Contact