I have created a class with which I can insert
, update
and delete
records from Salesforce using their bulk API. I have searched the web and have come across various resources; but I cannot seem to understand how to perform an upsert
.
For instance, I can perform an update with the following via HTTP POST to the API:
XML:
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>update</operation>
<object>contact</object>
<contentType>CSV</contentType>
</jobInfo>
CSV:
Id,FirstName,LastName,Department,Birthdate,Description
"003i000000EpehQ","Tomas","Jones","Marketing","1940-06-07Z","Self-described as "
"the top"" branding guru on the West Coast"
"003i000000EpYI7","Ian","Dury","R&D","","World-renowned expert in fuzzy logic de
sign. Influential in technology purchases."
However, there is no such example in their documentation for an upsert
. How can I perform an upsert
with my sample data?
Ref. http://www.salesforce.com/us/developer/docs/api_asynch/api_asynch.pdf
Update
The following code is generated when I try to do an upsert:
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>upsert</operation>
<object>contact</object>
<contentType>CSV</contentType>
</jobInfo>
When submitting the job, I get The remote server returned an error: (400) Bad Request.
Everything works perfectly when I try to update
, but when I try to upsert
I get the error. The job never gets created so the batch never even has a chance to get upsert
'd.
upsert
?