Wednesday, May 3, 2017

Batch Requests Support in ADF BC REST

ADF BC REST provides a set of enterprise features for REST, one of them support for batch requests. In single REST batch call we can execute multiple update, insert, delete and get operations. This is important functionality, it allows to minimize number of REST calls from the client and improves client performance. Take a read about it in developer guide - 22.13.7 Making Batch Requests.

Batch request in ADF BC REST is executed through POST. You need to specify root URL for REST request, complete path will be set in the payload. Make sure to include batch request Conent-Type:

Request is constructed with different parts, each part describes separate request operation - update, create, delete or get. Path to REST resource is specified too, along with payload if any:

Complete example of ADF BC REST batch request (one for update, create, delete and another for multiple get):

It is important to keep in mind - if one of the batch operations fails, other operations are reverted. In this example, validation fails for create operation - message is returned to the client:

Successful batch request returns back response data for each operation. This is useful, if you want to leverage response on the client - there is no need to do separate REST call to retrieve latest data:

I have logged execution output on the server side. Batch request is executing two update operations, create and delete. At the end single commit is called:

Very useful could be execute multiple get operations in single batch request. We can fetch data for different REST resources in one call to improve performance. In this example fetching data for Employees and Departments:

In response we get data for Employees under part1:

Data for Departments under part2:

Response structure is simple and this makes it easy to parse it on the client.

Access sample application code on GitHub repository - jetcrud.

1 comment:

Unknown said...

This look great Andrejus, much better than the oracle documentation, we've been struggling to get this working for a while. Orlando , Amec Foster Wheeler.