Though I can create jobs and add batches with the Bulk API, when I try to close a job Salesforce tells me that it can't parse by doing a POST request to https://INSTANCE_NAME-api.salesforce.com/services/async/29.0/job/JOB_ID with the following data:

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

and with the appropriate session headers (X-SFDC-Session: SESSION_ID) and content type (Content-Type: application/xml; charset=UTF-8), I get back a failure response:

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

I also tried posting to https://INSTANCE_NAME.salesforce.com/services/async/29.0/job/JOB_ID and received the same response.

When I do a GET request, I actually get back a successful response:

<?xml version="1.0" encoding="UTF-8"?><jobInfo

(edited out some of the information).

Any idea what I'm doing wrong? I believe I'm following the tutorial exactly.

I tried adding an id field to the request, like this:

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

But that didn't help either.


It turns out that you have to remove all whitespace from the request, so if you pass this, it will work:

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

I had the idea from a developer forum post on a different API where one of the Salesforce people mentioned that adding extra whitespace to the xml could cause a request to fail (and they said they would fix it).

  • I have also experienced whitespace issues with column names. If you have an extra space in the column name of your csv file, the entire batch fails. – abhi Sep 29 '16 at 13:07

I was getting the same error when I passed the state as "closed". Please check you are writing "Closed" (with 'C' capital). This might help because SF bulk API do not parse the request if it is not it is not as per the SF BULK API standard.

similarly state "insert" should be all small.

Please check and let me know if you still facing any issues.


I am developing an Oracle BPEL process to upsert the product information and Translations into SFDC and while closing the Job I faced the exact same issue. "Invalid Job"


  • Create New Job
  • Post the Data for Upsert
  • ..... Usual process ......
  • ..... Usual process ......
  • Before closing, have to make sure that the job is completed, only once the job is completed, the particular request works

    <?xml version="1.0" encoding="UTF-8"?>
    <jobInfo xlmns="http://www.force.com/2009/06/asyncapi/dataload">
  • For time being, once I post a request for uploading batch, i have a wait signal of 10 secs before executing my close job request.

This is a crude approach, but for time being this seems to be working fine and thought will share this information.

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.