Difference between revisions of "REST API:Obtain a Session ID"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
:;Use the getEnv from with the platform: | :;Use the getEnv from with the platform: | ||
:: For methods running inside the platform, use the Java [[ | :: For methods running inside the platform, use the Java [[Java API:Utility functions#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. |
Latest revision as of 22:36, 21 August 2013
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.