Simple AJAX Sync for web apps

In order to prepare our app hosting service here on, I have just enabled a very simple server to track your local storage entries and sync them with the app you are running locally.

It is by no means secure or complete, but does the “job” of backing up locally saved data. We will purge the data on that service on a regular basis and it is just meant as an example for our documentation.

Here are the functions available for App developers:

The API runs on and takes the following parameters:

appaction = What do you want to do?

appname = Which App is calling?

appid = which installation of the App is calling. This should be unique per user, not device. It will be enhanced with the next versions of the API server.

The avialable actions are:


Retrieve the status of the datasets on the server. Gives you the latest recorded entry from the database for your app:


which gives you a JSON object, containing the latest INDEX of an entry:


you may also notice the success=1 field in the JSON object.


The request command gives you up to 10 entries in a JSON result from the database. For that, you have to state the parameter “datetime” with the date and time since WHEN you want that list delivered and the parameter “pageno“, if you need to browse forward.

For example, you want to have all since 2015-02-28 11:30:55, you strip the extra characters and build the datetime string in PHP like this:

$start = Array('datetime' => '20150228113055', 'pageno' =>0);
$appdata = urlencode(json_encode($start));

and call the API with:


which also gives you a JSON Object back:

{"data":{"rows":2,"lines":[{"OZINDEX":"20150311155524-5673","OZAPPDATA":"{\"datetime\":\"20150301\",\"page\":0}"},{"OZINDEX":"20150311162704-4343","OZAPPDATA":"{\"My Value 1\":\"First value as string\",\"Second Value\":1234}"}]},"success":1}

containing the amount of rows (here 2) and the sub-object “lines” with the content of these two entries consisting of OZINDEX and OZAPPDATA.

So you can parse through the lines and add them locally, if you move Apps or need to catch up on data that was lost locally.


The 3rd part is for saving data on our JSON server to create backups and keeping a central data storage. Again you need the identification of the app and give your data to store as a JSON object (or anything you want to parse):


Please note that the appdata value is a URL encoded JSON-object. Also important: our servers do an ESCAPE around the data to prevent SQL injection. That could lead to errors on your side, if you parse the values in the wrong way or in escaped form.

Here is the link to the example STATUS. Let me know, what you think!

3 Replies to “Simple AJAX Sync for web apps”

  1. Pingback: Das App-Verzeichnis | HTML5 Apps und Produktivität

  2. Pingback: The App Directory is Ready For You | HTML5 Apps and Productivity

Leave a Reply