Reply
Regular Contributor
gymshock
Posts: 10
0
Accepted Solution

Bulk API Noob - using cURL, getting 'InvalidJob'

Hello, I'm going through the docs, just building the example client app using cURL on a Unix box with PHP, connecting using a free developer sandbox.  Using this command to send the job:

 

curl https://myinstance-api.salesforce.com/services/async/25.0/job -H 'X-SFDC-Session: mysessionID' -H "Content-Type: application/xml; charset=UTF-8" -d mypath/job.txt

 

getting this response/error:

<?xml version="1.0" encoding="UTF-8"?><error                                                                                                                             
   xmlns="http://www.force.com/2009/06/asyncapi/dataload">                                                                                                               
 <exceptionCode>InvalidJob</exceptionCode>                                                                                                                               
 <exceptionMessage>Unable to parse Job</exceptionMessage>   

 

As far as I can tell, the only thing different I'm doing from the docs is mypath instead of using '@' - if I use @, though, I get:

 

Warning: Couldn't read data from file "job.txt", this makes an empty POST.                                                                                               
<?xml version="1.0" encoding="UTF-8"?><error                                                                                                                             
   xmlns="http://www.force.com/2009/06/asyncapi/dataload">                                                                                                               
 <exceptionCode>InvalidJob</exceptionCode>                                                                                                                               
 <exceptionMessage>Unable to parse Job</exceptionMessage> 

 

...so I think I'm correct in giving the absolute path.  The text in 'job.txt' is copied directly from the docs, ie:

 

<?xml version="1.0" encoding="UTF-8"?>
<jobInfo xmlns="http://www.force.com/2009/06/asyncapi/dataload">
    <operation>insert</operation>
    <object>Contact</object>
    <contentType>CSV</contentType>
</jobInfo>

 

Can someone  help me determine what I may be doing wrong?

 

Moderator
SimonF
Posts: 7,975
0

Re: Bulk API Noob - using cURL, getting 'InvalidJob'

if you don't use @ then it sends the literal value, i.e. mypath/job.txt, you need to use @ to have to send the contents of the file.

Cheers
Simon
docs | blog | twitter
Regular Contributor
gymshock
Posts: 10
0

Re: Bulk API Noob - using cURL, getting 'InvalidJob'

So how do I direct curl to where the file resides? I've tried many varations (-d @job.txt, -d @'mypath/job.txt', -d 'mypath/@job.txt', -d mypath/@job.txt') - I've checkec the curl man and it doesn't seem clear on this ...

Regular Contributor
gymshock
Posts: 10
0

Re: Bulk API Noob - using cURL, getting 'InvalidJob'

My bad, I didn't include the full path *outside* the jail we were using.  Thank you for your response!