Storage Service Overview¶
The Storage Service is a flexible, scoped key-value store that is used in a number of other mobile services features, and that can be used in applications to store various developer-defined information. Application-level storage can be used to apply shared configuration to all app installations, such as general policies. The finer-grained user-level storage can hold user preferences, draft objects and other data that should be available across devices. Finally, the device-level storage can be used for information pertaining to the device or installation. The application configuration data is stored based on user or device preference. The storage service stores flexible data structure and supports application-level, user-level, and device-level storage. SAP Mobile Services offers authorization and authentication schemes that secure the data.
Procedure for Predefined Policies¶
- Enable policies in the SAP mobile service cockpit, e.g. the Log Upload policy of the Logging feature
- Use the SAP BTP SDK for Android or iOS, the Mobile Development Kit to automatically apply predefined policies
Procedure for Application Data¶
- Ensure the user is logged in to mobile services to gain access to user-level data. Additionally, to use device-level storage, acquire a device ID
- Use the SAP BTP SDK for Android or iOS or the Mobile Development Kit to build apps to access the storage service APIs or directly use mobile services HTTP APIs on other platforms
Feature Scope¶
Feature | Description |
---|---|
Key-value store | Flexibly store various information in the cloud |
Scoped access | Use application-wide scope to configure all installations, or use user-level and device-level storage for more specific information |
Storage Service API¶
Storage service facilitates application developers to persist mobile application specific data, such as user preferences, user contextual data, and application configuration.
Storage service does not contain business-specific data. Although you can create, update, or delete all the storage configurations using Runtime API and Admin API, there are some restrictions or conditions while using Runtime API.
Using Storage service, data can be stored at three levels:
- Application storage: persists global configuration and application default settings.
- User storage: persists user preferences
- Device storage: persists installation-specific or device-specific settings.
Application Storage¶
If you create an application storage configuration using Runtime API, then it is accessible to all users. If you get the
user storage or device storage for the application with overwrite=true
query parameter, then the application level
configuration gets merged into the response.
While creating or updating application storage configuration using Admin API, a __metadata
property
(com.sap.mobile.server.storage.admin.v1.StorageMetadata
type)
can be included for the application configuration to define read and write right control of the runtime API. If no ReadRole
s
or WriteRole
s are defined for an application configuration, then the application configuration can be accessed by all users,
similar to a Runtime API.
Once the ReadRole
s are defined for an application configuration, then the users who have the required roles can read the
application configuration using Runtime API. Similarly, only these users can get the merged application configuration, while
getting the user storage or device storage configuration with overwrite=true
query parameter using the Runtime API. Once
the WriteRole
s are defined for an application configuration, then the users who have the required roles can modify the
application configuration using Runtime API.
The required roles are mandatory for reading or writing the application configuration using Runtime API, if an application
storage configuration is created by Runtime API, but modified by Admin API to add ReadRole
s or WriteRole
s.
User Storage¶
Users can only access the user configurations that belong to them by using the Runtime API. When you get a user storage
configuration with overwrite=true
query parameter using the Runtime API, the response includes the merged application
configuration, which only the users who have the required ReadRole
can access it.
If a property is defined on both application storage and user storage, the one in user storage gets included in response
while getting with overwrite=true
query parameter. If no one is defined in the user storage, then the one on the
application storage gets included in response while getting with overwrite=true
query parameter.
Device Storage¶
User can only access the device configuration that belongs to them. While getting the device storage configuration for
an application with overwrite=true
query parameter using the Runtime API, the response includes the merged user storage
configuration and application storage configuration, which only the users who have the required ReadRole
can access it.
The device storage property has the highest priority, and the application storage property has the lowest priority.