Newer Version Available
Create a Job for Batches with Binary Attachments
You can use cURL to create a job for batches containing Attachment records.
For more information, see Send HTTP Requests with cURL.
- Create a text file called job.txt containing the following
text.
1<?xml version="1.0" encoding="UTF-8"?> 2<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload"> 3 <operation>insert</operation> 4 <object>Attachment</object> 5 <contentType>ZIP_CSV</contentType> 6</jobInfo> - Using a command-line window, execute the following cURL command
curl https://instance.salesforce.com/services/async/51.0/job -H "X-SFDC-Session: sessionId" -H "Content-Type: application/xml; charset=UTF-8" -d @job.txt
instance is the portion of the <serverUrl> element and sessionId is the <sessionId> element that you noted in the login response. For more information about logging in, see Step 1: Log In Using the SOAP API.
Salesforce returns an XML response with data such as the following.
1<?xml version="1.0" encoding="UTF-8"?> 2<jobInfo 3 xmlns="http://www.force.com/2009/06/asyncapi/dataload"> 4 <id>750D000000001SRIAY</id> 5 <operation>insert</operation> 6 <object>Attachment</object> 7 <createdById>005D0000001B0VkIAK</createdById> 8 <createdDate>2010-08-25T18:52:03.000Z</createdDate> 9 <systemModstamp>2010-08-25T18:52:03.000Z</systemModstamp> 10 <state>Open</state> 11 <concurrencyMode>Parallel</concurrencyMode> 12 <contentType>ZIP_CSV</contentType> 13 <numberBatchesQueued>0</numberBatchesQueued> 14 <numberBatchesInProgress>0</numberBatchesInProgress> 15 <numberBatchesCompleted>0</numberBatchesCompleted> 16 <numberBatchesFailed>0</numberBatchesFailed> 17 <numberBatchesTotal>0</numberBatchesTotal> 18 <numberRecordsProcessed>0</numberRecordsProcessed> 19 <numberRetries>0</numberRetries> 20 <apiVersion>51.0</apiVersion> 21 <numberRecordsFailed>0</numberRecordsFailed> 22 <totalProcessingTime>0</totalProcessingTime> 23 <apiActiveProcessingTime>0</apiActiveProcessingTime> 24 <apexProcessingTime>0</apexProcessingTime> 25</jobInfo> - Note the value of the job ID returned in the <id> element. Use this ID in subsequent operations.