+ Start a Discussion
James L.James L. 

How to get Session Id for Oauth by cURL command line



Any examples of getting Session Id for Oauth by cURL command line.



Best Answer chosen by Admin (Salesforce Developers) 
James L.James L.

All Answers

Niket SFNiket SF

Hello James,

   Please try with this


   A] var __sfdcSessionId = '{!GETSESSIONID()}'; In the first method you are using javascript to acess Session id whichgives the session id stored in the browser cookies.


   B]  "{!$Api.Session_ID}" when you are using this it means it gives you session id via Global variable.


If it help please mark as solved

James L.James L.

I didn't mean get Session ID through code.


Now I'm learning Web Serivce+Apex, and I used cURL tool as a client tools to access my Apex web service.

all examples in the developer guide give sample command as to how to access  Apex web service through cURL command line. All these examples include the sessionID argument, but don't include how to get the session ID just through cURL command.


I know this question has nothing to do with Apex. But I just could find the answer to it somewhere else.



James L.James L.
This was selected as the best answer