close http session through REST

111 views
Skip to first unread message

Miklos Espak

unread,
Dec 10, 2012, 7:22:31 PM12/10/12
to xnat_di...@googlegroups.com, Nielsen, Casper
Hi,

I need to close http sessions through the REST API.

The documentation does not say anything about this, but I tried it in my naive way and it seems to work. See the last command below.

Can somebody confirm that this is a standard feature that I can rely on? If yes then it could be added to the documentation pages.

Cheers,
Miklos

Create a session:
wes:xnat-scripts espakm$ curl -u demo:demo -X POST "https://hipposeg.cs.ucl.ac.uk/REST/JSESSION"
470D2A3153D92E3520D8614A58CBD4CA

Query all projects by the session id (no authentication):
wes:xnat-scripts espakm$ curl --cookie JSESSIONID=470D2A3153D92E3520D8614A58CBD4CA -X GET "https://hipposeg.cs.ucl.ac.uk/REST/projects?format=csv"
"ID","secondary_ID","name","description","pi_firstname","pi_lastname","URI"
"DEMO","DEMO","DEMO","Demo project for hippocampus segmentation with sample data",,,"/data/projects/DEMO"

Delete the session:
wes:xnat-scripts espakm$ curl --cookie JSESSIONID=470D2A3153D92E3520D8614A58CBD4CA -X DELETE "https://hipposeg.cs.ucl.ac.uk/REST/JSESSION"

Haas, Evan

unread,
Dec 11, 2012, 9:27:30 AM12/11/12
to xnat_di...@googlegroups.com

Hi Miklos,

 

I tried this out and it appears to be designed for your use case (re-use of a session across multiple command line REST calls).  The code does in fact invalidate the HTTP session when you DELETE it.

 

I’ve added some more details to the doc for this call:  https://wiki.xnat.org/pages/viewpage.action?pageId=6226264

 

Evan

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To post to this group, send email to xnat_di...@googlegroups.com.
To unsubscribe from this group, send email to xnat_discussi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xnat_discussion?hl=en.




The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Miklos Espak

unread,
Dec 11, 2012, 10:08:25 AM12/11/12
to xnat_di...@googlegroups.com, Nielsen, Casper
Thank you, Evan!

Cheers,
Miklos
Reply all
Reply to author
Forward
0 new messages