0

I am bit confused here. I have been going through the BULK API document and got confused on few things.

It says

 All HTTP requests must contain a valid API session ID obtained with the SOAP API login() call. The session ID is returned in the
SessionHeader

1) Can I get this Session ID with connected App. I believe, connected App provide the token which can't be used here. Please take a look at screenshot.

2) It's also explain CURL to get the token. Can I get the hit the URL to get the session . I don't want to consume WSDL just for Login call..

enter image description here .

  • 1
    You can just strip it down to a login-only WSDL, since you don't need any of the other calls, by the way. I'm not 100%, but you should be able to use a connected app, assuming it has API permission. Make sure you check your "scope." Try using your browser's session (document.cookie.match(/sid=(.+?);/)[1] on a console), or using the Username-Password Flow, which you can call from CURL pretty easily. – sfdcfox Jun 16 '15 at 22:52
  • I am happy it got ur attention. I have always been following ur post and gone through ur below post as well..salesforce.stackexchange.com/questions/18565/…. I have been using connected App username-password flow for other integration but in REST response I get accessToken not the sessionid and in understand that.. However, I got confused when I saw attached screenshot where there is SessionId in CURL response.. – amidstCloud Jun 16 '15 at 22:56
  • In addition document mentioned" All HTTP requests must contain a valid API session ID obtained with the SOAP API login() call. The session ID is returned in the SessionHeader"..... I can't use the browser session as I'll be using a client java application which will create the Job and batches with data in XML request – amidstCloud Jun 16 '15 at 22:59
  • @amidstCloud If you already have the accessToken from the username-password flow AND your connected app has the API permission in the scope then you can use it interchangeably with the session id. I.e. Use the accessToken you have as the session ID in the Bulk API request. – Daniel Ballinger Jun 17 '15 at 1:18
0

The steps shown in Logging In Using the SOAP API show how to make the minimum required POST call with an XML body to get the Session Id using cURL. All it does it skip the tooling that most languages provide around WSDL processing and directly makes the resulting web request.

Here is exactly the same thing shown in the Postman Chrome plugin. You could do the same request easily enough from Java, .NET, or any other programming language.

Post request to get Salesforce login SessionId

Then you just parse the Session ID out of the XML response.

However, as noted in the comments. The accessToken that you get from the OAuth flows can be used interchangeably with the sessionId if it was established using the api or full scope values.

E.g. Using the accessToken to call the Bulk API.

Calling the Bulk API

|improve this answer|||||

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.