Step 5: Check Batch Status
curl https://instance.salesforce.com/services/async/64.0/job/jobId/batch/batchId -H "X-SFDC-Session: sessionId"
instance is the portion of the <serverUrl> element and sessionId is the <sessionId> element that you noted in the login response. jobId is the job ID that was returned when you created the job. batchId is the batch ID that was returned when you added a batch to the job.
Salesforce returns an XML response with data such as this:
<?xml version="1.0" encoding="UTF-8"?>
<batchInfo
xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<id>751x00000000079AAA</id>
<jobId>750x0000000005LAAQ</jobId>
<state>Completed</state>
<createdDate>2009-09-01T17:44:45.000Z</createdDate>
<systemModstamp>2009-09-01T17:44:45.000Z</systemModstamp>
<numberRecordsProcessed>2</numberRecordsProcessed>
<numberRecordsFailed>0</numberRecordsFailed>
<totalProcessingTime>5820</totalProcessingTime>
<apiActiveProcessingTime>2166</apiActiveProcessingTime>
<apexProcessingTime>0</apexProcessingTime>
</batchInfo>
If Salesforce can’t read the batch content or if the batch contains errors, such as invalid field names in the CSV header row, the batch state is Failed. When the batch state is Completed, all records in the batch have been processed. However, individual records could have failed. To see the status of individual records, retrieve the batch result.
Checking the status of each individual batch isn't necessary. You can check the status for all batches that are part of the job by running this cURL command:
curl https://instance.salesforce.com/services/async/64.0/job/jobId/batch -H "X-SFDC-Session: sessionId"