You need to sign in to do that
Don't have an account?
Kapil_Khandelwal
Upload JSON data using BULK api
I am willing to upload JSON data using BULK api. I know how to upload CSV data using BULK api.
I referred to the steps mentioned here - https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_quickstart_requests_intro.htm
My login.txt looks like this (it is not giving any error):
job.txt is as follows:
Make a note that I had changed contentType to "JSON".
Now when I run the following curl command to create json job:
I get an error - {"exceptionCode":"InvalidJob","exceptionMessage":"Unable to parse Job"}
And when I run the following curl command (Note the Content-Type has been changed here):
The job gets created but it is of type "CSV". So when I try to add json data into this job by creating a batch, I get an error - Wrong content-type for batch (application/json), job is of type: text/csv
Please help me on how to create a job with Content-Type as JSON and how to upload JSON data into that job.
Thanks in advance.
I referred to the steps mentioned here - https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_quickstart_requests_intro.htm
My login.txt looks like this (it is not giving any error):
?xml version="1.0" encoding="utf-8" ?> <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Body> <n1:login xmlns:n1="urn:partner.soap.sforce.com"> <n1:username><my_username></n1:username> <n1:password><my_pasword></n1:password> </n1:login> </env:Body> </env:Envelope>
job.txt is as follows:
<?xml version="1.0" encoding="UTF-8"?> <jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload"> <operation>insert</operation> <object>Account</object> <contentType>JSON</contentType> </jobInfo>
Make a note that I had changed contentType to "JSON".
Now when I run the following curl command to create json job:
curl https://<my_instance>.salesforce.com/services/async/43.0/job -H "X-SFDC-Session: <my_sessionId>" -H "Content-Type: application-json; charset=UTF-8" -d @job.txt
I get an error - {"exceptionCode":"InvalidJob","exceptionMessage":"Unable to parse Job"}
And when I run the following curl command (Note the Content-Type has been changed here):
curl https://<my_instance>.salesforce.com/services/async/43.0/job -H "X-SFDC-Session: <mu_sessionId>" -H "Content-Type: application-xml; charset=UTF-8" -d @job.txt
The job gets created but it is of type "CSV". So when I try to add json data into this job by creating a batch, I get an error - Wrong content-type for batch (application/json), job is of type: text/csv
Please help me on how to create a job with Content-Type as JSON and how to upload JSON data into that job.
Thanks in advance.