Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Panel

Contents

Table of Contents

Related



Anchor
create-session
create-session
Create A New User Session

This call allows for manual management of HTTP sessions within XNAT. This is particularly useful when you want to re-use the same session across multiple curl or XNATDataClient calls.

Code Block
POST - /data/JSESSION

Parameters: None

Response: A new JSESSION ID string, for example:

Code Block
3940FAAC4CB8DD368A9A1575372ECBBA

You can then use this JSESSION ID in a cookie in lieu of user credentials to authenticate subsequent calls, e.g.:

Code Block
languagetext
themeDJango
titleTerminal
curl --cookie JSESSIONID=3940FAAC4CB8DD368A9A1575372ECBBA -X GET http://10.1.1.17/xnat/data/projects


Note

The JSESSION ID can expire, or can be manually forced to expire by site administrators. Session expiration will invalidate any future operations attempting to use this cookie.


Anchor
current-session
current-session
Get ID Of Current User Session

Returns the JSESSION ID for the currently logged in user.

Code Block
GET - /data/JSESSION

Parameters: None

Response: A JSESSION ID string


Anchor
invalidate-session
invalidate-session
Invalidate The Current User Session

This is a way of manually logging off and preventing your cookie from being used once you have completed your operation. If you run this in the browser, all your current login sessions will immediately expire.

Code Block
DELETE - /data/JSESSION/

Parameters: None

Response: None

Tip

A site administrator can end all active user sessions for a different user in the Administer > Users panel, or by posting a DELETE call to /xapi/users/active/{username}. See User Management API