Posted in:

REST API FAQs


JSESSION: a reusable session id (aka cookie), expires after 15 minutes of inactivity.
EXP_ID: experiment id, will always take the form: CNDA_Ennnnn
SUBJ_ID: subject id, will always take the form: CNDA_Snnnnn
EXP_LABEL: experiment label, your user-friendly experiment label
SUBJ_LABEL: subject label, your user-friendly subject label
EXP: either EXP_ID or EXP_LABEL is acceptable here
SUBJ: either SUBJ_ID or SUBJ_LABEL is acceptable here

1. Create a JSESSION.
JSESSION=`curl -u ${username} "https://cnda.wustl.edu/REST/JSESSION"`

2. Delete your JSESSION when you are through.
curl -b JSESSIONID=$JSESSION -X DELETE "https://cnda.wustl.edu/REST/JSESSION"

3. Move an experiment (MR session, PET session, clinical data, etc.) to a different subject.
$DESTINATION_SUBJ_ID: the subject id to which you are moving the session
curl -b JSESSIONID=$JSESSION -X PUT "https://cnda.wustl.edu/data/projects/$PROJ/subjects/$DESTINATION_SUBJ_ID/experiments/$EXP_ID"

4. Moving subjects and experiments (MR session, PET session, clinical data, etc.) into different projects
$DESTINATION_PROJ_ID: the project id to which you are moving the subject or session

Subject:
curl -b JSESSIONID=$JSESSION -X PUT "https://cnda.wustl.edu/REST/projects/$PROJ/subjects/$SUBJ/projects/$DESTINATION_PROJ_ID?primary=true"
 
Experiment:
curl -b JSESSIONID=$JSESSION -X PUT "https://cnda.wustl.edu/REST/projects/$PROJ/subjects/$SUBJ/experiments/$EXP/projects/$DESTINATION_PROJ_ID?primary=true"

5. Sharing subjects and experiments into other projects:

Subject:
curl -b JSESSIONID=$JSESSION -X PUT "https://cnda.wustl.edu/REST/projects/$PROJ/subjects/$SUBJ/projects/$PROJ_SHARE?label=$SUBJ_LABEL_TO_SHARE"

Experiment:
curl -b JSESSIONID=$JSESSION -X PUT "https://cnda.wustl.edu/REST/projects/$PROJ/subjects/$SUBJ/experiments/$EXP/projects/$PROJ_SHARE?label=$EXP_LABEL_TO_SHARE"

6. Set visit_id on an experiment (mr session, pet session, clinical data, etc).

This example is for mr session:
curl -b JSESSIONID=$JSESSION -X PUT "https://cnda.wustl.edu/data/archive/projects/$PROJ/subjects/$SUBJ/experiments/$EXP?xsiType=xnat:mrSessionData&xnat:experimentData/visit_id=$VISIT_ID"