この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

バイナリ型の添付ファイルを含むバッチに対するジョブの作成

このセクションでは、添付ファイルレコードを含んだバッチを処理するためのジョブを、cURL を使用して作成する方法について説明します。cURL についての詳細は、cURL を使用した HTTP 要求の送信を参照してください。

cURL を使用してジョブを作成する手順は、次のとおりです。

  1. 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>

    このジョブで処理するバッチは CSV 形式のデータを含むため、contentTypeZIP_CSV に設定されています。バッチが XML 形式のデータを含む場合は、ZIP_XML と設定します。

    メモ

  2. コマンドラインウィンドウを使用して、次の cURL コマンドを実行します。

    curl https://instance.salesforce.com/services/async/32.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>32.0</apiVersion>
    21  <numberRecordsFailed>0</numberRecordsFailed>
    22  <totalProcessingTime>0</totalProcessingTime>
    23  <apiActiveProcessingTime>0</apiActiveProcessingTime>
    24  <apexProcessingTime>0</apexProcessingTime>
    25</jobInfo>
  3. <id> 要素内に返されたジョブ ID の値をメモしておいてください。後続の処理で使用します。