Enter your keyword

post

Execute batch requests in Oracle Visual Builder

Execute batch requests in Oracle Visual Builder

VB supports the batch request API which can be used to perform multiple operations(get, create, update, delete) in a single call.

The data is committed at the end of the requests, and if any one of the operations gets fails then the complete batch is rolled back.

The benefit of making batch requests is to increase the performance of the application as you can call multiple operations in a single call.

Below are the details of the batch requests REST APIs:

Sample Request

URL: <VB_BASE_URL>

HTTP Method: POST

Content Type: application/vnd.oracle.adf.batch+json

Sample Request:

{
   "parts":[
      {
         "id":"part1",
         "path":"/Employee",
         "operation":"create",
         "payload":{
            "firstName":”neeraj",
            "lastName":”kumar",
            "emailAddress":”nerraj.jain@gmail.com"
         }
      },
      {
         "id":"part2",
         "path":"/Employee/21",
         "operation":"update",
         "payload":{
            "emailAddress":"ankur.jain@gmail.com"
         }
      },
      {
         "id":"part3",
         "path":"/Employee/27",
         "operation":"delete"
      },
      {
         "id":"part4",
         "path":"/Employee/1",
         "operation":"get"
      }
   ]
}

Sample Response:

{
    "parts": [
        {
            "id": "part1",
            "path": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee",
            "operation": "create",
            "payload": {
                "id": 41,
                "creationDate": "2021-10-17T07:44:49+00:00",
                "lastUpdateDate": "2021-10-17T07:44:49.047+00:00",
                "createdBy": "ankur",
                "lastUpdatedBy": "ankur",
                "firstName": "neeraj",
                "lastName": "kumar",
                "emailAddress": "nerraj.jain@gmail.com",
                "links": [
                    {
                        "rel": "self",
                        "href": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/41",
                        "name": "Employee",
                        "kind": "item",
                        "properties": {
                            "changeIndicator": "test"
                        }
                    },
                    {
                        "rel": "canonical",
                        "href": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/41",
                        "name": "Employee",
                        "kind": "item"
                    },
                    {
                        "rel": "child",
                        "href": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/41/child/phoneCollection",
                        "name": "phoneCollection",
                        "kind": "collection"
                    }
                ]
            }
        },
        {
            "id": "part2",
            "path": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/1",
            "operation": "update",
            "payload": {
                "id": 1,
                "creationDate": "2021-10-12T16:22:08+00:00",
                "lastUpdateDate": "2021-10-14T11:14:04.031+00:00",
                "createdBy": "ankur",
                "lastUpdatedBy": "ankur",
                "firstName": "Ankur",
                "lastName": "Jain",
                "emailAddress": "ankurjain.jain26@gmail.com",
                "links": [
                    {
                        "rel": "self",
                        "href": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/1",
                        "name": "Employee",
                        "kind": "item",
                        "properties": {
                            "changeIndicator": "test"
                        }
                    },
                    {
                        "rel": "canonical",
                        "href": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/1",
                        "name": "Employee",
                        "kind": "item"
                    },
                    {
                        "rel": "child",
                        "href": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/1/child/phoneCollection",
                        "name": "phoneCollection",
                        "kind": "collection"
                    }
                ]
            }
        },
        {
            "id": "part4",
            "path": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/1",
            "operation": "get",
            "payload": {
                "id": 1,
                "creationDate": "2021-10-12T16:22:08+00:00",
                "lastUpdateDate": "2021-10-14T11:14:04.031+00:00",
                "createdBy": "ankur",
                "lastUpdatedBy": "ankur",
                "firstName": "Ankur",
                "lastName": "Jain",
                "emailAddress": "ankurjain.jain26@gmail.com",
                "links": [
                    {
                        "rel": "self",
                        "href": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/1",
                        "name": "Employee",
                        "kind": "item",
                        "properties": {
                            "changeIndicator": "dsdsd"
                        }
                    },
                    {
                        "rel": "canonical",
                        "href": "https://oicdev01-iddkls4brftz-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/1",
                        "name": "Employee",
                        "kind": "item"
                    },
                    {
                        "rel": "child",
                        "href": "https://oicdev01-test-ia.integration.ocp.oraclecloud.com:443/ic/builder/design/TestApp/1.0/resources/data/Employee/1/child/phoneCollection",
                        "name": "phoneCollection",
                        "kind": "collection"
                    }
                ]
            }
        }
    ]
}

You can look at the below video to know how to execute the batch request using POSTMAN:

https://youtu.be/SrbFmeqQPAg

Further readings:

Convert JSON to String Oracle Integration

Oracle Integration Message Packs and Pricing

Business Identifiers in Oracle Integration

You can subscribe to my YouTube channel for further reading.

Leave a Reply

Your email address will not be published.