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
MrTikMrTik 

bulk api: create-job: content-type issue

While running the curl examples for bulk api. I'm hitting an enfuriating circular pattern of errors. If I run this (with serverUrl and sessionId properly populated:

curl <serverUrl> -H "X-SFDC-Session: <sessionId>" -H "Content-Type: application/xml; charset=UTF-8" -H "Accept: application/xml" -H"Host: test.salesforce.com" -H "Connection: keep-alive" -d create-job.xml

I get this:
<faultstring>content-type of the request should be text/xml</faultstring>

If I run this:
curl <serverUrl> -H "X-SFDC-Session: <sessionId>" -H "Content-Type: text/xml; charset=UTF-8" -H "Accept: application/xml" -H"Host: test.salesforce.com" -H "Connection: keep-alive" -d create-job.xml

I get this:
<faultstring>SOAPAction HTTP header missing</faultstring>

What am I missing here?

MrTikMrTik
Forgot to mention. If I populated the header with a SOAPAction, I get:
<faultstring>Content is not allowed in prolog.</faultstring>
Ben BurhansBen Burhans
I hit a similar error with the Bulk API v2 using JSON; it's not doing proper Content-Type and Accept header parsing, and doesn't like the charset or other extra values. Test it on the workbench without the "; charset=UTF-8" and see if that works for you. This seems to only apply to certain endpoints or HTTP methods; checking a job's status, for example, doesn't have this problem.