Skip to main content
Skip table of contents

Post batch

Post a batch with tasks.

Each batch will receive a unique ID. A batch comprises one or more batch tasks (up to a maximum of 1000). A batch task is defined with batch task parameters. Each batch task will be executed using the specified Dynamo Application template (DAP) with the given parameters.

Batch posting is asynchronous, indicating that the post will return after the batch is successfully posted, but the batch tasks have not yet started or finished.

The batch status can be obtained with "get batch status."

The batch task status can be obtained with "get batch task status."

URI

POST: /v1/batch

Post Body

The post body contains JSON with a template reference, tasks with template parameters, and integration parameters.

The JSON property "template" defines a reference to the Dynamo Application (DAP) template. The value depends on the template source type (Salesforce file ID, template cache file ID).

When Salesforce is in use, the integration type is "Salesforce." Salesforce integration parameters should include the current session ID and Salesforce server URL.

Task parameters are required to include an "id" parameter to represent the Salesforce record.

Additional parameters can be added to the task params section. In the template, given parameters are available from the "param" map.

CODE
{
  "template" : "templateId", 
  "tasks" : [
    {
      "params" : {
        "id" : "sfRecordId"
      }
    }
  ],
  "integration" : 
   {
     "type" : "Salesforce",
     "sessionID" : "sessionId",
     "serverURL" : "xxx.saleforce.com"
  } 
}

Example

CODE
POST: https://dynamo-api.documill.com/v1/batch
{
  "template" : "3242374783", 
  "tasks" : [ 
    {
      "params" : {
        "id" : "1111"
      }
    },
    {
      "params" : {
        "id" : "2222"
      }
    }
  ],
  "integration" : {
    "type" : "Salesforce",
    "sessionID" : "xxxx",
    "serverURL" : "xxx.saleforce.com"
  } 
}

Post using embedded DAP

If a DAP is passed within the post request, a multipart request must be posted.

CODE
POST /v1/batch HTTP/1.1
Host: dynamo-api.documill.com
Content-Type: multipart/form-data;boundary="boundary"

--boundary
Content-Disposition: form-data; name="template"; filename="example.dap"
Content-Type: application/octet-stream

-- binary data --
--boundary
Content-Disposition: form-data; name="data";
Content-Type: application/json

{
  "tasks" : [ 
    {
      "params" : { 
         "id": <sfRecordID> 
       },
    }
  ],
  "integration" : {
    "type" : "Salesforce",
    "sessionID" : "xxxx",
    "serverURL" : "xxx.saleforce.com"
  } 
}
--boundary--

Posting additional JSON part

It is possible to post additional parameters as separate JSON parts in the multipart request. JSON part’s Content-Disposition name value must specify the parameter name “param.paramName“.

CODE
--boundary
Content-Disposition: form-data; name="param.additionalData";
Content-Type: application/json

{
  "data1": "abc",
  "data2": {
    "data3": "xyz"
  }
}
--boundary--

Note: For additional JSON parts to be attached to a certain task, the task has to have a partParams-property set.

CODE
{
  "tasks" : [ 
    {
      "params": { 
         "id": <sfRecordID> 
       },
      "partParams: [
         {
           "partName": <jsonPartName>,
           "paramName": <paramName>
         }
       ]
    }
  ],
  "integration" : {
    "type" : "Salesforce",
    "sessionID" : "xxxx",
    "serverURL" : "xxx.saleforce.com"
  } 
}

partParams: <Array> consisting of objects that define the parts to be merged into the task’s params. Supports merging multiple JSON parts into task params. If data is mapped from multiple JSON parts under the same paramName, later data overwrites earlier.

partParams.partName: <String> that links a JSON part to a task. For example, if multipart request includes additional data in a JSON part which Content-Disposition’s name value is “param.additionalData”, partName would then have to be set as “additionalData”.

partParams.paramName: <String> that defines where in task’s params map the JSON part’s data is put.

Success Response

A successful batch post will return HTTP response status code 202 (Accepted) and a JSON body:

CODE
{
    "id": "074608c2393f272d31870bd0e01f9652",
    "tasks": [
        "334b2fc3-49cf-4089-a09b-f638fb1f97dc",
        "c4cc984a-9169-4b9f-8e57-add16cf2513d"
    ],
    "message": "Success",
    "licenseUsage": 2
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.