No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Creating a Batch with Binary Attachments
After creating the job, you're ready to create a batch of Attachment records. You send data in batches in separate HTTP POST requests. In this example, you create and submit one batch. For guidelines on how to organize your data in different batches, see General Guidelines for Data Loads.
To create a batch and submit it using cURL:
- Create a zip batch file. For this sample, the file is named request.zip.
- Using a command-line window, execute the following cURL command:
curl https://instance.salesforce.com/services/async/30.0/job/jobId/batch -H "X-SFDC-Session: sessionId" -H "Content-Type:zip/csv" --data-binary @request.zip
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.
Salesforce returns an XML response with data such as the following:
1<?xml version="1.0" encoding="UTF-8"?> 2<batchInfo 3 xmlns="http://www.force.com/2009/06/asyncapi/dataload"> 4 <id>751D000000003uwIAA</id> 5 <jobId>750D000000001TyIAI</jobId> 6 <state>Queued</state> 7 <createdDate>2010-08-25T21:29:55.000Z</createdDate> 8 <systemModstamp>2010-08-25T21:29:55.000Z</systemModstamp> 9 <numberRecordsProcessed>0</numberRecordsProcessed> 10 <numberRecordsFailed>0</numberRecordsFailed> 11 <totalProcessingTime>0</totalProcessingTime> 12 <apiActiveProcessingTime>0</apiActiveProcessingTime> 13 <apexProcessingTime>0</apexProcessingTime> 14</batchInfo>Salesforce does not parse the CSV content or otherwise validate the batch until later. The response only acknowledges that the batch was received.
- Note the value of the batch ID returned in the <id> element. You can use this batch ID later to check the status of the batch.
For details on proceeding to close the associated job, check batch status, and retrieve batch results, see the Quick Start.