Best Practice | Batch Requests
  • 25 Mar 2025
  • 1 Minute to read
  • Dark
    Light

Best Practice | Batch Requests

  • Dark
    Light

Article summary

Introduction

CMIC’ s REST platform supports execution of multiple operations in a single batch request. The platform commits data at the end of the request, so that if one batch request fails all changes are rolled back and an error response is returned.

Request

  • URL
    • [BASE URL]/[Application]/rest
  • HTTP Method
    • POST
  • Content-Type
    • application/vnd.oracle.adf.batch+json

Payload

Here is an template payload structure when submitting batch requests. Payload contains a JSON structure with the following attributes:

Parts

This is an array of part objects. Each part contains id, path, operation, and payload attributes. Note that all of the following attributes are REQUIRED.

Following tables describes each of the required parts attribute.

AttributeDescription
pathThis is the path to the endpoint resource. As an example /1/pyemployee is used for HCM employee resource.
operationThis is the specific operation that is executed for this resource. Available values are create, update, delete, upsert, and get
idUnique id of object, this is to identify a specific request.
payloadThis section lists endpoint specific attributes.
{
    "parts": [
        {
            "path": "/1/[resource]",
            "operation": "create",
            "id": "part1",            
            "payload": {
                "attribute 1" : "value",
                "attribute 2" : "value",
                "attribute 3" : "value"
            }
        }
    ]
}

Examples

Example 1 - Updating muliple Employees

Here is an example a request for updaing multiple employees within an HCM application.

  • URL
    • [BASE URL]/hcm-rest-api/rest
  • HTTP Method
    • POST
  • Content-Type
    • application/vnd.oracle.adf.batch+json
  • Payload
{
    "parts": [
        {
            "id": "part1",
            "path": "/1/pyemployee",
            "operation": "create",
            "payload": {
                "attribute 1" : "value",
                "attribute 2" : "value",
                "attribute 3" : "value"
            }
        }
    ]
}