Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Create a Job for Batches with Binary Attachments
For more information, see Walkthrough Sending HTTP Requests with cURL.
- Create a text file called job.txt containing this
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 this cURL command
curl https://instance.salesforce.com/services/async/67.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>67.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.