Goodies‎ > ‎

TinyWebDB Services

Note: the versions of alltags-deletable-tinywebdb-fall14.zip created before Dec. 14, 2014, had a bug in which they did not properly handle top-level string values containing spaces and commas. For example, a tag with value "this string has spaces" would appear to have the truncated value "this" within App Inventor, and a tag with value "one,two,three,four" would appear to have the truncated value "one" within App Inventor. The Dec. 14, 2014 version of alltags-deletable-tinywebdb-fall14.zip fixes this problem.

Attached to this page are two .zip files containing simple web services for App Engine and an App Inventor .aia program for testing them. These services are much more powerful than the standard custom web services for App Inventor because they support operations like deletion and listing all tags and all entries. However, they work with the existing TinyWebDB blocks; the extra features are provide by using special tags.

You can experiment with the CS117 instances of these services (linked below) or make your own instances by following these instructions.

Read the documentation below to understand the difference between the services.

For feedback or bug reports on any of these services (except the standard overwriting service), please email fturbak asperand wellesley.edu.

AllTags Deletable Overwriting TinyWebDB Service

This web service is like the standard overwriting table-based TinyWebDB (customtinywebdb), except:
  • getting the special tag *all_tags* returns a list of all tags in the database (except for *all_tags* itself).
  • getting the special tag *all_values* returns a list of all values in the database, in the same order as the tags in *all_tags*.
  • getting the special tag *all_timestamps* returns a list of all values in the database, in the same order as the tags in *all_tags*.
  • getting the special tag *all_entries* returns a list of all tag/value/timestamp triples, where a triple is a list of three elements.
  • storing into a tag the special value *delete* deletes the entry at that tag (if it exists).
  • storing into the special tag *all_tags* the special value *delete* deletes all entries (except for *all_tags* itself).
  • storing into the special tags *all_values*, *all_timestamps*, or *all_values* has no effect.
  • The web interface to the database table has a WriteEntriesToPage button that writes a plain text page with a JSON list of tag/value pairs for each (non-special) tag in the database. This page can then be saved to a text file. Such a file can be read by AddEntriesFromFile.
  • The web interface to the database table has an AddEntriesFromFile button that reads from a specified file a JSON list of tag/value pairs and stores each value with the associated tag. If the contents of the file is not a JSON list of tag/value pairs, this button has no effect. In the web interface for /getvalue and /storeavalue, the third component of the returned JSON triple is not stringified. For example, under the key listtest store the value [1, "a"]. Then the web page for the result of /storeavalue displays ["STORED", "listtest", [1, "a"]] rather than ["STORED", "listtest", "[1, \"a\"]"] (the result in customtinywebdb). /getvalue behaves similarly.

You can experiment with an instance of this database at http://cs117-alltags-deletable.appspot.com/. You can create your own instance of this service by following these instructions using alltags-deletable-overwriting-tinywebdb-fall14.zip, attached below.

The AppInventor program AllTagsDeletableTinyWebDBTest.aia (attached below) can be helpful for experimenting with this service from an Android device. Keep in mind that all values stored in this program are strings, even if they might look like numbers or lists.

AllTags Deletable Listing TinyWebDB Service

This is a table-based web service for TinyWebDB in which storing a value at a tag adds that value at the end of a list of all values stored at the tag.
  • getting a tag that has not been stored returns the empty list (not the empty string).
  • getting the special tag *all_tags* returns a list of all tags in the database (except for *all_tags* itself).
  • getting the special tag *all_values* returns a list of all value-lists in the database, in the same order as the tags in *all_tags*.
  • getting the special tag *all_entries* returns a list of all tag/value-list pairs, where a pair is a list of two elements.
  • storing in a tag the special value *delete* deletes the entry at that tag (if it exists).
  • storing in the special tag *all_tags* the special value *delete* deletes all entries (except for *all_tags* itself).
  • This service does not support *all_timestamps*, a WriteEntriesToPage button, or an AddEntriesFromFile button. Contact fturbak asperand wellesley.edu if you need these features.

You can experiment with an instance of this database at http://cs117-alltags-deletable-list.appspot.com/. You can create your own instance of this service by following these instructions using alltags-deletable-list-tinywebdb.zip, attached below.

The AppInventor program AllTagsDeletableTinyWebDBTest.aia (attached below) can be helpful for experimenting with this service from a phone. Keep in mind that all values stored in this program are strings, even if they might look like numbers or lists.

ċ
AllTagsDeletableTinyWebDBTest.aia
(6k)
Franklyn A Turbak,
Nov 29, 2014, 3:32 PM
ċ
alltags-deletable-list-tinywebdb-fall14.zip
(31k)
Franklyn A Turbak,
Dec 6, 2014, 6:01 PM
ċ
alltags-deletable-tinywebdb-fall14.zip
(24k)
Franklyn A Turbak,
Dec 14, 2014, 8:24 AM