Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have been successfully able to use REST API for my application but I found that Bulk API will be better for my application. So, now I am trying to switch to Bulk API but I am stuck at the first step. I am not able to create new job. This is the error I am getting:

<?xml version="1.0" encoding="UTF-8"?><error
 <exceptionMessage>Unable to parse Job</exceptionMessage>

This is the job.txt file I am using:

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

I also used my custom object that I created in my account (Statement_c) but that also not work.

This is the code I am using:

open_job($instance_url, $access_token);

function open_job($instance_url, $session_id){
    $url = "$instance_url/services/async/26.0/job";

    $content = array("file"=>"@job.txt");

    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-SFDC-Session: $session_id",
        "Content-type: application/xml; charset=UTF-8"));
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $content);

    $response = curl_exec($curl);
    echo $response;
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    echo $status;

Few things that I made sure but if you think they could still be the problem let me know and I will check again:

1> job.txt data is being sent to the post and their is no problem with that.

2> session id and instance url are right.

I am not sure if I am using right API version. Please tell me how to find that?

Please tell me where am I wrong?

share|improve this question
The only difference I can tell between your code and my [working] code is that you're specifying API version 26.0, and I'm specifying version 29.0. This link should tell you the latest version: salesforce.com/us/developer/docs/api_asynch –  Dave Clausen Dec 30 '13 at 19:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.