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
Venkat RanganVenkat Rangan 

How to specify SessionId for Bulk API POST request.

Hi,

I am following the example here for getting started on Bulk API.

https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_jobs_create.htm?language=en

The Job Creation XML is sent using a HTTP POST where the Authorization Header has the Bearer: <OAuth Token>

The response I get is:

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

Where can I specify the Session ID for the Create Job call to succeed?

Just for reference, the XML that is posted (per example) is:

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

Thanks!


Sumeet_ForceSumeet_Force
Hi,
You need to provide the session ID as a header using following syntax:
Authorization: Bearer [session ID]
Colon is just distinguisher between header name and header value. Authorization is the header name and Bearer [session Id] is the value.
No colon is required within the header value i.e. after bearer just a space followed by session id is enough.
 
tresta14tresta14
Hi Venkat,

I have been suffering the same issue in that the response after successful basic authentication does not include the session id. As a result, I get the same error as you, regardless of the authorization header combinations included in the create job call (e.g. OAuth 00Ds***** or Bearer 00Ds***).

There is a field called "id" that is returned in a successful authentication response, which returns a url of the form "https://test.salesforce.com/id/00D4******K/0054*****Q". What are these, seeing as neither seem to be the session id.

Thanks,

Daniel