Everyone knows what is OData protocol – It is for accessing diverse data in a common way. With OData adaptor in HCI you can connect any OData service provider and perform the required integration scenario.
In this blog I am explaining how to do a batch request with multiple operations on different OData collections.
If you are new to OData adaptor read this blog: OData Adapter in SAP HANA Cloud Integration
An OData batch request allows you to execute multiple operations in a single HTTP request.
Let’s take an example.
- Assume that you have two OData collections – Products and SalesOrders.
- You should be able to do a batch with multiple operations as given below.
- But, if you are using OData adaptor, you will find that you don’t have an option to choose multiple OData collections as given below.
- It doesn’t mean that HCI is not stopping you from doing a batch request with multiple operations on different OData collections.
- The solution is to send the batch request in the payload irrespective of what you configured in the model operation.
- To show you how it works I have created a simple iFlow. (I am not going to the basics of creating an iflow, if you are new to HCI read this blog)
- I have two OData collections – Products, SalesOrders.
- In my batch request I want to create a Product and a SalesOrder.
- Hence the equivalent batch request payload to be used in HCI content modifier body is given below.
- For your reference the I have attached the body used in the postman rest client, download it here.
- The format of the batch request body to be used is given below. It will be same from all OData services.
- The details for the payload could be taken from the metadata of OData service.
- Given below I have highlighted entitySetName and entityTypeName in my metadata.
- If your backend is an on premise system (ex. SAP Gateway) you need to configure HANA Cloud Connector with your HCI as mentioned in this blog.
- In the adaptor settings the address should be referring to your virtual host and port configured in HCC. And the Proxy Type should be On-Premise.
- Choose a model operation with batch processing enabled. The Odata collection chosen could be independent of the batch payload we are using.
- Now we could deploy the project and see how the two create operations (create product and create salesorder) worked through a batch request.
SAP Technology RIG