No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Walk Through the Bulk Query Sample
Create a Job
The following example shows how to use bulk query from the command line using cURL.
- Create a file called create-job.xml containing
the following text:
- Using a command-line window, execute the following cURL command
to create a job:
curl -H "X-SFDC-Session: sessionId" -H "Content-Type: application/xml; charset=UTF-8" -d @create-job.xml https://instance.salesforce.com/services/async/33.0/job
instance is the portion of the <serverUrl> element and sessionId is the <sessionId> element that you noted in the login response.
Salesforce returns an XML response with data such as the following:
Add the Job to a Batch
- Create a file called query.txt to contain
the SOQL query statement.
- Using a command-line window, execute the following cURL command to add the job to a batch:
curl —d @query.txt -H "X-SFDC-Session: sessionId" -H "Content-Type: text/csv; charset=UTF-8” https://instance.salesforce.com/services/async/33.0/job/jobId/batch
jobId is the job ID returned in the response to the job createion.
Salesforce returns an XML response with data such as the following:
Check the Status of the Job and Batch
- Using a command-line window, execute the following cURL command
to check the job status:
curl -H "X-SFDC-Session: sessionId" https://instance.salesforce.com/services/async/33.0/job/jobId
Salesforce returns an XML response with data such as the following:
- Using a command-line window, execute the following cURL command
to check the batch status:
curl -H "X-SFDC-Session: sessionId" https://instance.salesforce.com/services/async/33.0/job/jobId/batch/batchId
batchId is the batch ID in the response to the batch creation.
Salesforce returns an XML response with data such as the following:
Retrieve the Results
- Using the command-line window, execute the following cURL command
to retrieve the batch result list:
curl -H "X-SFDC-Session: sessionId" https://instance.salesforce.com/services/async/33.0/job/jobId/batch/batchId/result
Salesforce returns an XML response with data such as the following:
- Using the command-line window, execute the following cURL command
to retrieve the results of the query:
curl -H "X-SFDC-Session: sessionId" https://instance.salesforce.com/services/async/33.0/job/jobId/batch/batchId/result/resultId
resultId is the result ID in the response to the batch result list request.
Salesforce returns an XML response with data such as the following: