Newer Version Available

This content describes an older version of this product. View Latest

Add a Batch to a Job

Add a new batch to a job by sending a POST request to the following URI. The request body contains a list of records for processing.
URI
/services/async/APIversion/job/jobid/batch

The API version in the URI for all batch operations must match the API version for the associated job.

Note

Example XML request body
1<?xml version="1.0" encoding="UTF-8"?>
2<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload">
3  <sObject>
4    <description>Created from Bulk API</description>
5    <name>[Bulk API] Account 0 (batch 0)</name>
6  </sObject>
7  <sObject>
8    <description>Created from Bulk API</description>
9    <name>[Bulk API] Account 1 (batch 0)</name>
10  </sObject>
11</sObjects>
In this sample, the batch data is in XML format because the contentType field of the associated job was set to XML. For alternative formats for batch data, such as CSV or JSON, see JobInfo.
Example XML response body
1<?xml version="1.0" encoding="UTF-8"?>
2<batchInfo
3   xmlns="http://www.force.com/2009/06/asyncapi/dataload">
4 <id>751D0000000004rIAA</id>
5 <jobId>750D0000000002lIAA</jobId>
6 <state>Queued</state>
7 <createdDate>2009-04-14T18:15:59.000Z</createdDate>
8 <systemModstamp>2009-04-14T18:15:59.000Z</systemModstamp>
9 <numberRecordsProcessed>0</numberRecordsProcessed>
10 <numberRecordsFailed>0</numberRecordsFailed>
11 <totalProcessingTime>0</totalProcessingTime>
12 <apiActiveProcessingTime>0</apiActiveProcessingTime>
13 <apexProcessingTime>0</apexProcessingTime>
14</batchInfo>
Example JSON request body
1[
2   {
3      "Name":"[Bulk API] Account 0 (batch 0)",
4      "description" : "Created from Bulk API"
5   },
6   {
7      "Name":"[Bulk API] Account 1 (batch 0)",
8      "description" : "Created from Bulk API"
9   }
10]
In this sample, the batch data is in JSON format because the contentType field of the associated job was set to JSON.
Example JSON response body
1{
2   "apexProcessingTime":0,
3   "apiActiveProcessingTime":0,
4   "createdDate":"2015-12-15T21:56:43.000+0000",
5   "id":"751D00000004YGZIA2",
6   "jobId":"750D00000004SkVIAU",
7   "numberRecordsFailed":0,
8   "numberRecordsProcessed":0,
9   "state":"Queued",
10   "systemModstamp":"2015-12-15T21:56:43.000+0000",
11   "totalProcessingTime":0
12}

You can add batch jobs using non–Bulk API–compliant CSV files. See Map Data Fields.

Note