API Express caching.


API Express offers caching and offline mode to work when device is not connected to the internet.


Caching and Offline Mode

Caching and offline mode is available only for services which were generated using the API Express Generator extension.

API Express has two types of services:

  1. Generated REST API.
  • Automatically generated REST API services for a database table.
  • This service type has support for caching and offline mode.
  1. Custom REST API.
  • A service created with the visual Service Builder.
  • This service type has support for caching only.

To test caching and offline mode, we recommend to this API Express test page.


A Custom REST API service has caching enabled automatically.


Caching On/Off

There is no option today to turn off caching. If you think it's an important capability, please let us know and we will add it to our todo list.

When an app is online (connected to the internet) and a custom service is invoked, its response is stored on client storage (IndexedDB) as the following object: { “service signature” : “service response” }.

Service signature is a hash which is calculated using the URL, query parameters with values, and header parameters (except X-Appery-Security-Token header) with values and body.

A custom service cache has expiration time. Expiration time is set to 12 hours. After 12 hours a cached records will be removed only if the app is online. We are working on a setting to allow to set a custom expiration time.

When an app is offline and a custom service is invoked, the SDK calculates the hash code of this call based on the URL, query parameters with values, and header parameters with values (except the X-Appery-Security-Token header). If the calculated hash matches a service response stored in the cache, that response will be used.

Every API Express custom service has request parameter cached (set to false by default).

If this parameter is set to true, the Client SDK gets information from cache even when Client SDK is in online mode.

When Client SDK is in offline mode despite the value of this parameter Client SDK always gets information from cache.

It is recommended to use caching for GET requests. Note that POST, PUT requests will not be synchronized when the app move to online mode.

The following table summarizes from where the data will be retrieved:

ClientSDKCached ParameterGet Data From