Batch Request

Invokes multiple operations on data related to multiple agencies in a single HTTP request. The Batch Request API accepts an array of up to 25 HTTP requests, each with its required headers, body, method, and URL. The individual operations are invoked via HTTPS. The response is an array containing the results from all requested operations in the same order used in the request array.

Resource Information

Scopebatch_request
App TypeAll
Authorization TypeNo authorization required
URI /v4/batch
HTTP MethodPOST
Automation Version(s)All

Request Information

Field or ParameterTypeRequiredValuesDescriptionAutomation Version
bodystringNoA JSON string containing the request parameters for the operation to be invoked.All
headersheaders{}NoContains HTTP headers for the operation to be invoked.All
headers.<headerKey>stringNoHTTP header key/value pairs. For example: "headers" : { "header-key1":"header-value1", "header-key2":"header-value2" }. Provide the HTTP headers required by the operation's authorization type. If the required HTTP headers related to authorization are not provided, the operation will fail. All
methodstringYesGET | PUT | POST | DELETEThe HTTP method of the operation to be invoked.All
relativeUrlstringYesThe relative URL of the operation to be invoked, for example '/v4/records'. Do not invoke the Batch Request API; i.e. do not specify '/v4/batch' as the relativeUrl.All

Example

Sample Request Head

POST https://apis.accela.com/v4/batch

Sample Request Body

[
  {
    "headers": {
      "x-accela-agency": "DemoAgency"
    },
    "method": "GET",
    "relativeUrl": "/v4/records?offset=0&limit=2"
  },
  {
    "headers": {
      "x-accela-agency": "BPTDEV"
    },
    "method": "GET",
    "relativeUrl": "/v4/records/BPTDEV-15EST-00000-00014"
  },
  {
    "headers": {
      "x-accela-agency": "BPTDEV"
    },
    "method": "POST",
    "relativeUrl": "/v4/records",
    "body": {
      "type": {
        "id": "Building-Residential-Alteration-NA"
      },
      "description": "Residence alteration",
      "parcels": [
        {
          "parcelNumber": "005020018"
        }
      ]
    }
  }
]

Response Information

FieldTypeDescriptionAutomation Version
resultresult{}Contains the response data from all requested operations.All
result.result[]result.result{}The HTTP response from the invoked operation. The order of the results in the response array corresponds to the same order used in the request array.All
result.statusintegerThe HTTP status from the invoked operation.All
statusintegerThe record status.All

Example

Sample Response Body

{
  "result": [
    {
      "code": "unauthorized",
      "message": "Your session has expired.",
      "status": 401,
      "traceId": "150424233314336-300cc585"
    },
    {
      "result": [
        {
          "createdBy": "PUBLICUSER0",
          "customId": "15CAP-00000023",
          "description": "",
          "id": "BPTDEV-15EST-00000-00014",
          "initiatedProduct": "ACA",
          "jobValue": 0.0,
          "module": "Building",
          "openedDate": "2015-02-25 00:00:00",
          "recordClass": "INCOMPLETE",
          "serviceProviderCode": "BPTDEV",
          "statusDate": "2015-02-25 21:56:48",
          "totalJobCost": 0.0,
          "trackingId": 233083706,
          "type": {
            "alias": "Building/api/test/test",
            "category": "test",
            "group": "Building",
            "id": "Building-api-test-test",
            "module": "Building",
            "subType": "test",
            "text": "Building/api/test/test",
            "type": "api",
            "value": "Building/api/test/test"
          },
          "undistributedCost": 0.0,
          "value": "15EST-00000-00014"
        }
      ],
      "status": 200
    },
    {
      "code": "data_validation_error",
      "message": "wrong type which does not exist.",
      "status": 400,
      "traceId": "150424233314352-c68cabea"
    }
  ],
  "status": 200
}