/data/JSESSION

 

Introduction

This call allows for manual management of HTTP sessions within XNAT, in particular the ability to re-use the same session across multiple curl/XNATRestClient/XNATDataClient calls.

Summary

HTTP CommandRequest & Response format
GET: REQnone (pass JSESSIONID as cookie)
GET: RESPString (JSESSIONID)
PUT: REQnot allowed
PUT: RESPnot allowed
POST: REQnone (pass user credentials via calling mechanism)
POST: RESPString (JSESSIONID)
DELETE: REQnone (pass JSESSIONID as cookie)
DELETE: RESPnone

POST

Creates a new session for the provided user credentials and returns the associated JSESSIONID:

curl -u admin:admin -X POST http://localhost:8080/xnat/data/JSESSION
 
63DC08FCC7B8DD6F02C72044EF29FE19

You can then use this JSESSIONID (in lieu of user credentials) to authenticate subsequent calls:

curl --cookie JSESSIONID=63DC08FCC7B8DD6F02C72044EF29FE19 -X GET http://localhost:8080/xnat/data/projects
 
{"ResultSet":{"Result":[{"secondary_ID":"XNAT-1652","pi_lastname":"","description":"","name":"XNAT-1652","ID":"XNAT-1652","pi_firstname":"","URI":"/data/projects/XNAT-1652"},{"secondary_ID":"TIP","pi_lastname":"","description":"","name":"TIP","ID":"TIP","pi_firstname":"","URI":"/data/projects/TIP"}], "totalRecords": "2"}}

PUT

Not allowed for this call (use POST to create a new session).

GET

Echos the JSESSIONID of the session identified by the provided cookie:

curl --cookie JSESSIONID=63DC08FCC7B8DD6F02C72044EF29FE19 -X GET http://localhost:8080/xnat/data/JSESSION

63DC08FCC7B8DD6F02C72044EF29FE19

DELETE

Invalidates the session associated with the provided JSESSIONID:

curl --cookie JSESSIONID=63DC08FCC7B8DD6F02C72044EF29FE19 -X DELETE http://localhost:8080/xnat/data/JSESSION

[no response, session is invalidated on the server]

$label.name