function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RahulBorgaonkar@BritsafeRahulBorgaonkar@Britsafe 

BULK API Error - Example from Bulk API Developer's Guide - Page 74.

Hi All,

I am writing a BULK API script using CURL command same as example discussed in Bulk API Developer's Guide page 74. I have wrote below script 
-------------------------------------------------------------------------------------------------------------------------
#!/bin/bash

export client_id='not for sharing'
export client_secret='not for sharing'
export username='not for sharing'
export password='not for sharing'
export returnvalues='./returnvalues.txt'
export createjob='./createjob.txt'
export batchDetails='./batchDetails.txt'
export instanceURL='https://cs14.salesforce.com/services/async/32.0/job' 
export loginURL='https://test.salesforce.com/services/oauth2/token'

curl https://test.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=$client_id" -d "client_secret=$client_secret" -d "username=$username" -d "password=$password" -o 

$returnvalues -s

sessionId=`cat $returnvalues | sed 's/[{}]/''/g' | awk -v RS=',"' -F: '/^access_token/{print $2}' | sed 's/\(^"\|"$\)//g'`

echo $sessionId

curl -H "X-SFDC-Session: $sessionId" -H "Content-Type: application/xml; charset=UTF-8" -d @create-job.xml $instanceURL -o $createjob -s

cat $createjob
echo ""

jobId=`grep id $createjob | sed 's/<\/id>//' | sed 's/ *<id>//'`

echo $jobId

jobURL=$instanceURL'/'$jobId'/batch'

echo $jobURL

curl —d @query.txt -H "X-SFDC-Session: $sessionId" -H "Content-Type: text/csv; charset=UTF-8" $jobURL
-------------------------------------------------------------------------------------------------------------------------
On last line as curl is adding a job to batch, I am getting an error as

https://cs14.salesforce.com/services/async/32.0/job/750c0000000Xuso/batch
curl: (6) Could not resolve host: 97d
curl: (6) Could not resolve host: query.txt
<?xml version="1.0" encoding="UTF-8"?><batchInfoList
   xmlns="http://www.force.com/2009/06/asyncapi/dataload" />

Any idea about the problem ? I am using sames steps from the guide. Could you please help ?

The output should be similar following. 

<?xml version="1.0" encoding="UTF-8"?>
<batchInfo
xmlns="http://www.force.com/2009/06/asyncapi/dataload">
<id>751x000000009vwAAA</id>
<jobId>750x000000009tvAAA</jobId>
<state>Queued</state>
<createdDate>2011-03-10T00:59:47.000Z</createdDate>
<systemModstamp>2011-03-10T00:59:47.000Z</systemModstamp>
<numberRecordsProcessed>0</numberRecordsProcessed>
<numberRecordsFailed>0</numberRecordsFailed>
<totalProcessingTime>0</totalProcessingTime>
<apiActiveProcessingTime>0</apiActiveProcessingTime>
<apexProcessingTime>0</apexProcessingTime>
</batchInfo>

Please reply,

Best Regards,

Rahul Borgaonkar
 
ShashankShashank (Salesforce Developers) 
Please see if these links help:
http://community.dreamfactory.com/t/cannot-connect-to-salesforce-custom-domain/305
http://stackoverflow.com/questions/1341644/curl-and-https-cannot-resolve-host