Newer Version Available

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

Get Batch Results

Get results of a batch that has completed processing by sending a GET request to the following URI. If the batch is a CSV file, the response is in CSV format. If the batch is an XML or JSON file, the response is in XML or JSON format, respectively.

Alternatively, you can monitor a Bulk API batch in Salesforce. To track the status of bulk data load jobs and their associated batches, from Setup, enter Bulk Data Load Jobs in the Quick Find box, then select Bulk Data Load Jobs. Click the Job ID to view the job detail page.

The job detail page includes a related list of all the batches for the job. The related list provides View Request and View Response links for each batch. If the batch is a CSV file, the links return the request or response in CSV format. If the batch is an XML or JSON file, the links return the request or response in XML or JSON format, respectively. These links are available for batches created in API version 19.0 and later. For Bulk V2 type jobs, batch information is unavailable. The View Response link returns the same results as the following URI resource.

URI
https://instance_name—api.salesforce.com/services/async/APIversion/job/jobid/batch/batchId/result
Example request body
No request body is allowed.
Example response body
For an XML batch
1<?xml version="1.0" encoding="UTF-8"?>
2<results xmlns="http://www.force.com/2009/06/asyncapi/dataload">
3  <result>
4    <id>001D000000ISUr3IAH</id>
5    <success>true</success>
6    <created>true</created>
7  </result>
8  <result>
9    <id>001D000000ISUr4IAH</id>
10    <success>true</success>
11    <created>true</created>
12  </result>
13</results>
For a JSON batch
1[
2   {
3      "success" : true,
4      "created" : true,
5      "id" : "001xx000003DHP0AAO",
6      "errors" : []
7   },
8   {
9      "success" : true,
10      "created" : true,
11      "id" : "001xx000003DHP1AAO",
12      "errors" : []
13   }
14]
For a CSV batch
1"Id","Success","Created","Error"
2"003D000000Q89kQIAR","true","true",""
3"003D000000Q89kRIAR","true","true",""
4"","false","false","REQUIRED_FIELD_MISSING:Required fields are missing: [LastName]:LastName --"

The batch result indicates that the last record was not processed successfully because the LastName field was missing. The Error column includes error information. You must look at the Success field for each result row to ensure that all rows were processed successfully. For more information, see Handle Failed Records in Batches.

Note