バイナリ添付ファイルを含むバッチに対するジョブの作成
添付ファイルレコードを含んだバッチを処理するためのジョブを、cURL を使用して作成できます。
詳細は、「cURL を使用した HTTP 要求の送信」を参照してください。
-
job.txt という名前のテキストファイルを作成し、次のテキストを含めます。
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> - コマンドラインウィンドウを使用して、次の cURL コマンドを実行します。
curl https://instance.salesforce.com/services/async/41.0/job -H "X-SFDC-Session: sessionId" -H "Content-Type: application/xml; charset=UTF-8" -d @job.txt
instance は、ログインの応答でメモした <serverUrl> 要素の一部分です。sessionId は同様にメモした <sessionId> 要素です。ログインについての詳細は、「ステップ 1: SOAP API を使用したログイン」を参照してください。
Salesforce により、次のようなデータを含む XML 応答が返されます。
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>41.0</apiVersion> 21 <numberRecordsFailed>0</numberRecordsFailed> 22 <totalProcessingTime>0</totalProcessingTime> 23 <apiActiveProcessingTime>0</apiActiveProcessingTime> 24 <apexProcessingTime>0</apexProcessingTime> 25</jobInfo> - <id> 要素内に返されたジョブ ID の値をメモしておいてください。後続の処理で使用します。