SalesforceBulk Connector Reference

The following operations allow you to work with the Salesforce Bulk Connector. Click an operation name to see parameter details and samples on how to use it.


Initialize the connector

Salesforce Bulk API uses the OAuth protocol to allow application users to securely access data without having to reveal their user credentials. For more information on how authentication is done in Salesforce, see Understanding Authentication.

To use the Salesforce Bulk connector, add the <salesforcerest.init> element in your configuration before carrying out any other Salesforce Bulk operations.

salesforcebulk.init

The salesforcerest.init operation initializes the connector to interact with the Salesforce REST API. See the related API documentation for more information.

Parameter Name Description Required
apiVersion The version of the Salesforce API. Yes
accessToken The access token to authenticate your API calls. Yes
apiUrl The instance URL for your organization. Yes
tokenEndpointHostname The instance url for OAuth 2.0 token endpoint when issuing authentication requests in your application. If you haven't set any token endpoint hostname, the default hostname https://login.salesforce.com will be set. No
refreshToken The refresh token that you received to refresh the API access token. Yes
clientId The consumer key of the connected application that you created. Yes
clientSecret The consumer secret of the connected application that you created. Yes
intervalTime The time interval in milliseconds, after which you need to check the validity of the access token. Yes
registryPath The registry path of the connector. You must specify the registry path as follows: registryPath = “connectors/salesforcebulk” Yes

Sample configuration

<salesforcebulk.init>
    <apiVersion>{$ctx:apiVersion}</apiVersion>
    <accessToken>{$ctx:accessToken}</accessToken>
    <apiUrl>{$ctx:apiUrl}</apiUrl>
    <tokenEndpointHostname>{$ctx:tokenEndpointHostname}</tokenEndpointHostname>
    <refreshToken>{$ctx:refreshToken}</refreshToken>
    <clientId>{$ctx:clientId}</clientId>
    <clientSecret>{$ctx:clientSecret}</clientSecret>
    <intervalTime>{$ctx:intervalTime}</intervalTime>
    <registryPath>{$ctx:registryPath}</registryPath>
</salesforcebulk.init>

Sample request

<salesforcebulk.init>
    <apiVersion>34.0</apiVersion>
    <accessToken>00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV</accessToken>
    <apiUrl>https://ap17.salesforce.com</apiUrl>
    <tokenEndpointHostname>{$ctx:tokenEndpointHostname}</tokenEndpointHostname>
    <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
    <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
    <clientSecret>5437293348319318299</clientSecret>
    <intervalTime>1000000</intervalTime>
    <registryPath>connectors/SalesforceBulk</registryPath>
</salesforcebulk.init>

Working with Jobs

createJob

The salesforcebulk.createJob method creates a new job based on the properties that you specify. See the related API documentation for more information.

Parameter Name Description Required
operation The processing operation that the job should perform. Yes
contentType The content type of the job. Yes
object The object type of data that is to be processed by the job. Yes
externalIdFieldName The id of the external object. No

Sample configuration

Following is a sample request that can be handled by the createJob operation.

<salesforcebulk.createJob>
    <operation>{$ctx:operation}</operation>
    <contentType>{$ctx:contentType}</contentType>
    <object>{$ctx:object}</object>
    <externalIdFieldName>{$ctx:externalIdFieldName}</externalIdFieldName>
</salesforcebulk.createJob>

Sample request

<createJob>
   <apiVersion>34.0</apiVersion>
   <accessToken>00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV</accessToken>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <operation>insert</operation>
   <contentType>CSV</contentType>
   <object>Contact</object>
   <externalIdFieldName>Languages__c</externalIdFieldName>
</createJob>
updateJob

The salesforcebulk.updateJob method closes or aborts a job that you specify. See the related API documentation for more information.

Parameter Name Description Required
jobId The ID of the job that you either want to close or abort. Yes
state The state of processing of the job. Yes

Sample configuration

Following is a sample request that can be handled by the updateJob operation.

<salesforcebulk.updateJob>
    <jobId>{$ctx:jobId}</jobId>
    <state>{$ctx:state}</state>
</salesforcebulk.updateJob>

Sample request

<updateJob>
   <apiVersion>34.0</apiVersion>
   <accessToken>00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV</accessToken>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <jobId>75028000000MCtIAAW</jobId>
   <state>Closed</state>
</updateJob>
getJob

The salesforcebulk.getJob method retrieves all details of an existing job based on the job ID that you specify. See the related API documentation for more information.

Parameter Name Description Required
jobId The ID of the job that you either want to close or abort. Yes

Sample configuration

Following is a sample request that can be handled by the getJob operation.

<salesforcebulk.getJob>
    <jobId>{$ctx:jobId}</jobId>
</salesforcebulk.getJob>

Sample request

<getJob>
   <apiVersion>34.0</apiVersion>
   <accessToken>00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV</accessToken>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <jobId>75028000000MCqEAAW</jobId>
</getJob>

Working with Batches

addBatch

The salesforcebulk.addBatch method adds a new batch to a job based on the properties that you specify. See the related API documentation for more information.

Parameter Name Description Required
jobId The ID of the job that you either want to close or abort. Yes
objects A list of records to process. Yes
contentType The content type of the batch data. The content type you specify should be compatible with the content type of the associated job. Possible values are application/xml and text/csv. Yes
isQuery Set to true if the operation is query. Yes

Sample configuration

<salesforcebulk.addBatch>
    <jobId>{$ctx:jobId}</jobId>
    <objects>{$ctx:objects}</objects>
    <contentType>{$ctx:contentType}</contentType>
    <isQuery>{$ctx:isQuery}</isQuery>
</salesforcebulk.addBatch>

Sample request

Following is a sample request that can be handled by the addBatch operation, where the content type of the batch data is in application/xml format.

<addBatch>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <apiVersion>34.0</apiVersion>
   <accessToken>5Aep861TSESvWeug_xOdumSVTdDsD7OrADzhKVu9YrPFLB1zce_I21lnWIBR7uaGvedTTXJ4uPswE676H2pQpCZ</accessToken>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <contentType>application/xml</contentType>
   <isQuery>false</isQuery>
   <jobId>75028000000McSwAAK</jobId>
   <objects>
      <values>
         <sObject>
            <description>Created from Bulk API on Tue Apr 14 11:15:59 PDT 2009</description>
            <name>Account 711 (batch 0)</name>
         </sObject>
         <sObject>
            <description>Created from Bulk API on Tue Apr 14 11:15:59 PDT 2009</description>
            <name>Account 37811 (batch 5)</name>
         </sObject>
      </values>
   </objects>
</addBatch>
Following is a sample request that can be handled by the addBatch operation, where the content type of the batch data is in text/csv format.

<addBatch>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <apiVersion>34.0</apiVersion>
   <accessToken>5Aep861TSESvWeug_xOdumSVTdDsD7OrADzhKVu9YrPFLB1zce_I21lnWIBR7uaGvedTTXJ4uPswE676H2pQpCZ</accessToken>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <contentType>text/csv</contentType>
   <isQuery>false</isQuery>
   <jobId>75028000000McSwAAK</jobId>
   <objects>
      <values>Name,description
        Tom Dameon,Created from Bulk API
      </values>
   </objects>
</addBatch>
Following is a sample request that can be handled by the addBatch operation, where the operation is query and the content type of the bulk query results is in application/xml format.

<addBatch>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <apiVersion>34.0</apiVersion>
   <accessToken>5Aep861TSESvWeug_xOdumSVTdDsD7OrADzhKVu9YrPFLB1zce_I21lnWIBR7uaGvedTTXJ4uPswE676H2pQpCZ</accessToken>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <contentType>application/xml</contentType>
   <isQuery>true</isQuery>
   <jobId>75028000000McSwAAK</jobId>
   <objects>
      <values>SELECT Id, Name FROM Account LIMIT 100</values>
   </objects>
</addBatch>
getBatchStatus

The salesforcebulk.getBatchStatus method retrieves the status of a batch based on the properties that you specify. See the related API documentation for more information.

Parameter Name Description Required
jobId The unique identifier of the job to which the batch you specify belongs. Yes
batchId The unique identifier of the batch for which you want to retrieve the status. Yes

Sample configuration

Following is a sample request that can be handled by the getBatchStatus operation.

<salesforcebulk.getBatchStatus>
    <jobId>{$ctx:jobId}</jobId>
    <batchId>{$ctx:batchId}</batchId>   
</salesforcebulk.getBatchStatus>

Sample request

<getBatchStatus>
    <apiUrl>https://ap2.salesforce.com</apiUrl>
    <accessToken>5Aep861TSESvWeug_xOdumSVTdDsD7OrADzhKVu9YrPFLB1zce_I21lnWIBR7uaGvedTTXJ4uPswE676H2pQpCZ</accessToken>
    <apiVersion>34.0</apiVersion>
    <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
    <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
    <clientSecret>5437293348319318299</clientSecret>
    <intervalTime>1000000</intervalTime>
    <registryPath>connectors/SalesforceBulk</registryPath>
    <jobId>75028000000M5X0</jobId>
    <batchId>75128000000OZzq</batchId>
</getBatchStatus>
getBatchResults

The salesforcebulk.getBatchResults method retrieves results of a batch that has completed processing. See the related API documentation for more information.

Parameter Name Description Required
jobId The unique identifier of the job to which the batch you specify belongs. Yes
batchId The unique identifier of the batch for which you want to retrieve results. Yes

Sample configuration

Following is a sample request that can be handled by the getBatchResults operation.

<salesforcebulk.getBatchRequest>
    <jobId>{$ctx:jobId}</jobId>
    <batchId>{$ctx:batchId}</batchId>
</salesforcebulk.getBatchRequest>

Sample request

<getBatchResults>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <apiVersion>34.0</apiVersion>
   <accessToken>5Aep861TSESvWeug_xOdumSVTdDsD7OrADzhKVu9YrPFLB1zce_I21lnWIBR7uaGvedTTXJ4uPswE676H2pQpCZ</accessToken>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <jobId>75028000000M5X0</jobId>
   <batchId>75128000000OZzq</batchId>
</getBatchResults>
getBatchRequest

The salesforcebulk.getBatchRequest method retrieves a batch request based on the properties that you specify. See the related API documentation for more information.

Parameter Name Description Required
jobId The unique identifier of the job to which the batch you specify belongs. Yes
batchId The unique identifier of the batch for which you want to retrieve the batch request. Yes

Sample configuration

Following is a sample request that can be handled by the getBatchRequest operation.

<salesforcebulk.getBatchRequest>
    <jobId>{$ctx:jobId}</jobId>
    <batchId>{$ctx:batchId}</batchId>
</salesforcebulk.getBatchRequest>

Sample request

<getBatchRequest>
   <apiVersion>34.0</apiVersion>
   <accessToken>00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV</accessToken>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <jobId>75028000000MCtIAAW</jobId>
   <batchId>75128000000OpZFAA0</batchId>
</getBatchRequest>
listBatches

The salesforcebulk.listBatches method retrieves details of all batches in a job that you specify. See the related API documentation for more information.

Parameter Name Description Required
jobId The unique identifier of the job for which you want to retrieve batch details. Yes

Sample configuration

Following is a sample request that can be handled by the listBatches operation.

<salesforcebulk.listBatches>
    <jobId>{$ctx:jobId}</jobId>
</salesforcebulk.listBatches>

Sample request

<listBatches>
   <apiVersion>34.0</apiVersion>
   <accessToken>00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV</accessToken>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <jobId>75028000000MCqEAAW</jobId>
</listBatches>
getBulkQueryResults

The salesforcebulk.getBulkQueryResults method retrieves the bulk query results that you specify. See the related API documentation for more information.

Parameter Name Description Required
jobId The unique identifier of the job for which you want to retrieve batch details. Yes
batchId The unique identifier of the batch for which you want to retrieve the batch request. Yes
resultsId The unique identifier of the results for which you want to retrieve. Yes

Sample configuration

Following is a sample request that can be handled by the getBulkQueryResults operation.

<salesforcebulk.getBulkQueryResults>
    <jobId>{$ctx:jobId}</jobId>
    <batchId>{$ctx:batchId}</batchId>
    <resultsId>{$ctx:resultsId}</resultsId>
</salesforcebulk.getBulkQueryResults>

Sample request

<getBulkQueryResults>
   <apiVersion>34.0</apiVersion>
   <accessToken>00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV</accessToken>
   <apiUrl>https://ap2.salesforce.com</apiUrl>
   <refreshToken>5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL</refreshToken>
   <clientId>3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY</clientId>
   <clientSecret>5437293348319318299</clientSecret>
   <intervalTime>1000000</intervalTime>
   <registryPath>connectors/SalesforceBulk</registryPath>
   <jobId>75028000000MCqEAAW</jobId>
   <batchId>7510K00000Kzb6XQAR</batchId>
   <resultId>7520K000006xofz</resultId>
</getBulkQueryResults>

Working with Binary Attachments

createJobToUploadBatchFile

The salesforcebulk.createJobToUploadBatchFile method creates a job for batches that contain attachment records. See the related API documentation for more information.

Sample configuration

Following is a sample request that can be handled by the createJobToUploadBatchFile operation. It creates a job for batches that contain attachment records..

<salesforcebulk.createJobToUploadBatchFile>
</salesforcebulk.createJobToUploadBatchFile>

Sample request

http://localhost:8280/services/salesforcebulk_uploadBatchFile?apiUrl=https://ap2.salesforce.com&accessToken=00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV&apiVersion=34.0&refreshToken=5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL&clientId=3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY&clientSecret=5437293348319318299&intervalTime=1000000&jobId=75028000000MCv9AAG
getBulkQueryResults

The salesforcebulk.getBulkQueryResults method creates a batch of attachment records. See the related API documentation for more information.

Parameter Name Description Required
jobId The ID of the job for which you want to create a batch of attachment records. Yes

Sample configuration

Following is a sample request that can be handled by the uploadBatchFile operation.It creates a job for batches that contain attachment records.

<salesforcebulk.uploadBatchFile>
   <jobId>{$url:jobId}</jobId>
</salesforcebulk.uploadBatchFile>

Sample request

http://localhost:8280/services/salesforcebulk_uploadBatchFile?apiUrl=https://ap2.salesforce.com&accessToken=00D280000011oQO!ARwAQFPbKzWInyf.4veB3NY0hiKNQTxaSiZnPh9AybHplDpix34y_UOdwiKcL3e1_IquaUuO3A54A4thmSplNUQei9ARsNFV&apiVersion=34.0&refreshToken=5Aep861TSESvWeug_wHqvFVePrOMjj7CUFncs.cGdlPln68mKYpAbAJ9l7A5FTFsmqFY8Jl0m6fkIMWkIKc4WKL&clientId=3MVG9ZL0ppGP5UrDGNWmP9oSpiNtudQv6b06Ru7K6UPW5xQhd6vakhfjA2HUGsLSpDOQmO8JGozttODpABcnY&clientSecret=5437293348319318299&intervalTime=1000000&jobId=75028000000MCv9AAG
Top