Dynamic API allows you to interact with an OData service to perform complex queries and operations using the entity data model definition in the service metadata document. Classes for this layer are in the
com.sap.cloud.mobile.odata package, used primarily to interact with the OData provider.
Dynamic API is driven by metadata from the service metadata document of an OData provider. Entity sets, entity types and its properties (structural and navigation), and function imports are used as parameters to the API.
When interacting through an
OnlineODataProvider, dynamic API automatically loads and parses metadata from the OData provider as needed. You may invoke the
loadMetadata method to start the initialization. Once loaded, parsed metadata resides in memory but can also be cached in a file as an optimization.
Dynamic API provides a way to access the necessary information from the loaded metadata and present them as parameters. Without proxy classes, developers should use methods from the
DataService class to look up entity sets, entity types, properties, and data methods.
The API can protect the application against incompatible changes to the metadata by the OData service provider. The details of this mechanism are not discussed in this section as it is not common for a service provider to do so.
The four main classes for the API are:
DataService– Provides for the:
- Execution of queries defined by instances of DataQuery class
- Creation, updating, and deletion of entity instances and service operations
- Look up of entity sets, entity types and their properties.
The generated service class is derived from this class.
DataQuery– Provides for the definition of a complex query against entity sets within the service metadata document. The four main methods for construction of an OData query are:
ChangeSet– Implements an atomic change set that cannot include a query operation. Please note that, according to the OData specification, requests with the change set are not necessarily performed in the order specified.
RequestBatch– Implements the batching of multiple requests or change sets that allows including query operations, executed in the order specified