Newer Version Available

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

Use Bulk Query

When adding a batch to a bulk query job, the Content-Type in the header for the request must be either text/csv, application/xml, or application/json, depending on the content type specified when the job was created. The actual SOQL statement supplied for the batch is in plain text format.
URI
https://instance_name—api.salesforce.com/services/async/APIversion/job/jobid/batch
Bulk Query Request
Bulk API query doesn’t support the following SOQL:
  • COUNT
  • ROLLUP
  • SUM
  • GROUP BY CUBE
  • OFFSET
  • Nested SOQL queries

Bulk API query supports both query and queryAll operations. The queryAll operation returns records that have been deleted because of a merge or delete. The queryAll operation also returns information about archived Task and Event records. For more information, see queryAll() in the SOAP API Developer Guide.

Relationship queries traverse parent-to-child and child-to-parent relationships between objects to filter and return results. You can use SOQL relationships in bulk queries. For more information about SOQL relationships, see Using Relationship Queries in the SOQL and SOSL Reference.

Also, Bulk API can’t access or query compound address or compound geolocation fields.

Note

Requests, and Responses

The following are example Bulk Query requests and responses.

Create Bulk Query Batch HTTP Request
Create Bulk Query Batch HTTP Response Body
Get Batch Information for All Batches in a Job HTTP Request (used when PK chunking is enabled)
Get Batch Information for All Batches in a Job HTTP Response Body
Get Batch Results HTTP Request
Get Batch Results HTTP Response Body
Get Bulk Query Results HTTP Request
Get Bulk Query Results HTTP Response Body

Java Example Using WSC

The following example logs in to an organization using the Partner API, then instantiates a BulkConnection object using the service endpoint from the Partner API login.