Newer Version Available

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

Adding 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
https://instance_name—api.salesforce.com/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 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 on Tue Apr 14 11:15:59 PDT 2009</description>
5    <name>[Bulk API] Account 0 (batch 0)</name>
6  </sObject>
7  <sObject>
8    <description>Created from Bulk API on Tue Apr 14 11:15:59 PDT 2009</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, see JobInfo.
Example 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</batchInfo>

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

Note