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?

  • 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 Dec 30, 2013 at 19:03

2 Answers 2


I think you are specifying the object using the wrong name. You should be using the API name 'Statement__c' inside the object tag for custom objects, like:

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

Also, the API name probably has a double underscore.


For anyone using json request and getting same exception, use https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_jobs_create.htm in http post request body.

  "operation" : "insert",
  "object" : "Account",
  "contentType" : "CSV"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.