Setting scan variable

34 views
Skip to first unread message

Martin Craig

unread,
Nov 11, 2022, 5:55:41 AM11/11/22
to xnat_discussion
I'm looking to set custom variables on a scan. A previous thread (from some time ago) suggested that this could be done using a request like:

PUT  /REST/projects/HCP_Q2/subjects/100307/experiments/100307_3T/scans/305?xsiType=xnat:mrScanData&xnat:mrScanData/parameter/addParam[name=variable_name]/addField=TEST

Unfortunately I'm having no luck getting this to work. My url is:

<xnat_host>/data/projects/projectname/subjects/XNAT_S00017/experiments/XNAT_E00116/scans/64?xsiType=xnat:mrScanData&xnat:mrScanData/parameters/addParam[name=TEST]/addField=RESULT

The status code is 200 but I cannot find the parameter anywhere in the scan info.

Does this feature still exist and if so is there any sign of what I might be doing wrong here?

Thanks,
Martin

Charlie Moore

unread,
Nov 14, 2022, 10:54:35 AM11/14/22
to xnat_discussion
Hi Martin,

The main problem here with the call is probably URL-encoding of the parameters. Here's a curl call I just used to set an addParam:
curl -u admin:admin -X PUT "${DEV}/data/archive/experiments/XNAT_E00029/scans/4?xnat%3AmrScanData%2Fparameters%2FaddParam%5Bname%3Dsegmented%5D%2FaddField=1&xsiType=xnat%3AmrScanData"

I'd confirm that works for you with curl, and then try to adapt it to whatever REST client you wish.

Thanks,
Charlie Moore

Martin Craig

unread,
Nov 14, 2022, 11:17:58 AM11/14/22
to xnat_di...@googlegroups.com
Many thanks, that's done the trick. I should have paid attention to which bits were the url and which were parameters!
Martin

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/35bcd18f-7a22-4fb8-b3cb-9617e5a66c36n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages