Binary Async API not working with CONTENT_TYPE: ZIP_JSON
Last updated 2017-10-14 ·Reference W-3882899 ·Reported By 2 users
Summary
Uploading a Binary Attachment using Async BULK API is not working with CONTENT_TYPE: ZIP_JSON but works fine with ZIP_CSV
Repro
- Step 1 : Create a Job with Content Type : JSON File
Request :
curl https://instance.salesforce.com/services/async/39.0/job -H "X-SFDC-Session: sessionId" -H "Content-Type: application/xml; charset=UTF-8" -d @job.txt
In the above Request the job.tx should be in the below format :
<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<operation>insert</operation>
<object>Attachment</object>
<contentType>ZIP_JSON</contentType>
</jobInfo>
- Step 2: Create a Batch for Binary Attachment for same Job created in Step 1 :
Request :
curl https://instance.salesforce.com/services/async/39.0/job/jobId/batch -H "X-SFDC-Session: sessionId" -H "Content-Type:zip/csv" --data-binary @request.zip
For Creating *request.zip* just follow the steps below :
a). Create a base directory that contains the binary attachments. Attachments can be organized in subdirectories.
b). Create the request.txt CSV, XML, or JSON file in the base directory. The request.txt file is a manifest file for the attachments in the zip file and contains the data for
each record that references a binary file.
c). Create a zip file of the base directory and any subdirectories.
Result : The attached file is getting corrupted.
Workaround
Use CONTENT_TYPE: ZIP_CSV instead of CONTENT_TYPE: ZIP_JSON in Step 1.
Reported By (2)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.