Download API Asynch PDF

TitleAPI Asynch
File Size1.5 MB
Total Pages98
Table of Contents
                            Introduction
Quick Start
	Setting Up a Salesforce Developer Edition Organization
	Setting Up Your Client Application
	Sending HTTP Requests with cURL
		Step 1: Logging In Using the SOAP API
		Step 2: Creating a Job
		Step 3: Adding a Batch to the Job
		Step 4: Closing the Job
		Step 5: Checking Batch Status
		Step 6: Retrieving Batch Results
Planning Bulk Data Loads
	General Guidelines for Data Loads
	Using Compression for Responses
Preparing Data Files
	Finding Field Names
	Valid Date Format in Records
	Preparing CSV Files
		Relationship Fields in a Header Row
		Valid CSV Record Rows
		Sample CSV File
	Preparing XML Files
		Relationship Fields in Records
		Valid XML Records
		Sample XML File
Loading Binary Attachments
	Creating a request.txt File
	Creating a Zip Batch File with Binary Attachments
	Creating a Job for Batches with Binary Attachments
	Creating a Batch with Binary Attachments
Request Basics
	About URIs
	Setting a Session Header
Working with Jobs
	Creating a New Job
	Monitoring a Job
	Closing a Job
	Getting Job Details
	Aborting a Job
	Job and Batch Lifespan
Working with Batches
	Adding a Batch to a Job
	Monitoring a Batch
	Getting Information for a Batch
	Getting Information for All Batches in a Job
	Interpreting Batch State
	Getting a Batch Request
	Getting Batch Results
	Handling Failed Records in Batches
Bulk Query
	Bulk Query Processing
	Using Bulk Query
Reference
	Schema
	JobInfo
	BatchInfo
	Headers
		Batch Retry Header
		Line Ending Header
		PK Chunking Header
	HTTP Status Codes
	Errors
	Limits
Sample Client Application Using Java
	Set Up Your Client Application
	Walk Through the Sample Code
Sample Bulk Query Using cURL
	Walk Through the Bulk Query Sample
Mapping Data Fields
Glossary
Index
                        
Document Text Contents
Page 1

https://twitter.com/salesforcedocs

Page 2

© Copyright 2000–2015 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc.,
as are other names and marks. Other marks appearing herein may be trademarks of their respective owners.

Page 50

Using 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 or
application/xml, depending on the content type specified when the job was created. The actual SOQL statement supplied for
the batch will be in plain text format.

For queries on very large tables, use the PK Chunking header to split the query results into smaller chunks.

URI
https://instance_name—api.salesforce.com/services/async/APIversion/job/jobid/batch

Bulk Query Request

POST baseURI/job/750x00000000014/batch
X-SFDC-Session: 4f1a00D30000000K7zB!ARUAQDqAHcM...
Sforce-Enable-PK-Chunking: TRUE
Content-Type: [either text/csv or application/xml depending on job]

[plain text SOQL statement]

Note: Bulk API query doesn't support the following SOQL:

• COUNT

• ROLLUP

• SUM

• GROUP BY CUBE

• OFFSET

• Nested SOQL queries

• Relationship fields

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

Example: SOAP Headers, Requests, and Responses

The following are example Bulk Query requests and responses.

Create Bulk Query Batch HTTP Request

POST baseURI/job/750x00000000014/batch
X-SFDC-Session: 4f1a00D30000000K7zB!ARUAQDqAHcM...
Content-Type: text/csv; charset=UTF-8

SELECT Name, Description__c FROM Merchandise__c

Create Bulk Query Batch HTTP Response Body

<?xmlversion="1.0" encoding="UTF-8"?>
<batchInfo

xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<id>751x00000000079AAA</id>
<jobId>750x00000000014</jobId>
<state>Queued</state>
<createdDate>2009-09-01T17:44:45.000Z</createdDate>
<systemModstamp>2009-09-01T17:44:45.000Z</systemModstamp>

46

Using Bulk QueryBulk Query

Page 97

INDEX

A
Abort job 32
Add batch 6, 35
Attachments 13, 21

B
Batch lifespan 33
Batch Retry header 57
Batches

adding to a job 6, 35
checking status 8
creating 35
getting a request 40
getting information 37
getting information for job 38
getting results 41
handling failed rows 42
interpreting state 39
monitoring 36
retrieving results 9

Binary attachments
batch file 22
creating a batch 24
creating a job 23
introduction 21
manifest file 22
zip file 23

Bulk Query 44–46

C
Checking batch status 8
Client application 64, 77
Close job 7, 30
Code sample

setting up organization 4
setting up your client 64
walk through sample code 65, 77

Create batch 6, 35
Create job 5, 29
CSV

external ID 15
null values 16
polymorphic field 15
record rows 16
relationship field 15

CSV (continued)
sample file 17

CSV data files 15
cURL 4
cURL sample 77

D
Data files

CSV 15
date format 14
finding field names 14
introduction 13
mapping fields 81
XML 17

Date format 14

E
Error codes 59
Errors

batch results 42
External ID 15

F
Finding field names 14

G
Get job details 31
Get job status and results 31
Getting started sample 3, 64, 77
Guidelines

Compression in responses 12

H
Headers

Batch Retry 57
Line Ending 57
PK Chunking 58

HTTP requests 3–4
HTTP status codes 59

I
Introduction 1

J
Java client application 64
Job lifespan 33

93

Similer Documents