AgileApps Support Wiki Pre Release

Difference between revisions of "REST API:Obtain a Session ID"

From AgileApps Support Wiki
imported>Aeric
 
imported>Aeric
m (Text replace - ' getEnv(' to ' Functions.getEnv(')
Line 4: Line 4:
:: For methods running inside the platform, use the Java [[Utility_Calls#getEnv|getEnv()]] method to obtain the session ID:
:: For methods running inside the platform, use the Java [[Utility_Calls#getEnv|getEnv()]] method to obtain the session ID:
:::<syntaxhighlight lang="java" enclose="div">
:::<syntaxhighlight lang="java" enclose="div">
String sessionID = getEnv(ENV.SESSION.ID);
String sessionID = Functions.getEnv(ENV.SESSION.ID);
</syntaxhighlight>
</syntaxhighlight>


:;Programmatic login:
:;Programmatic login:
:: Use the code from the [[REST_API:login_Resource#Sample Login Client|Sample Login Client]] to programmatically log in and obtain the session ID from the response.
:: Use the code from the [[REST_API:login_Resource#Sample Login Client|Sample Login Client]] to programmatically log in and obtain the session ID from the response.

Revision as of 21:44, 14 October 2011

To obtain a session ID for use in making a REST request, there are a couple of options:

Use the getEnv from with the platform
For methods running inside the platform, use the Java getEnv() method to obtain the session ID:
<syntaxhighlight lang="java" enclose="div">

String sessionID = Functions.getEnv(ENV.SESSION.ID); </syntaxhighlight>

Programmatic login
Use the code from the Sample Login Client to programmatically log in and obtain the session ID from the response.