Versions Compared

Key

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

1. RESTAPI Basic Operation Manual

...

Step 3. Create the Artemis Scripts

For information about Artemis Job Submission, monitoring and management, please refer to the information page about Artemis.

https://sydneyuni.atlassian.net/wiki/spaces/RC/pages/190284213/Job+Submission

https://sydneyuni.atlassian.net/wiki/spaces/RC/pages/213090348/Job+Monitoring+and+Management

[unikey@login2 ~]$ vi run.pbs

#!/bin/bash

#PBS -P SASTEST

...

4. Use Cookie to perform XNAT RESTAPI call

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.


POST - /data/JSESSION


Parameters: Enter user credentials via calling mechanism, i.e:


$ curl -u username -X POST https://yourxnatdomain/data/JSESSION


Response: A new JSESSION ID string, for example:


3940FAAC4CB8DD368A9A1575372ECBBA


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

Get the SESSION Number

[unikey@login2 NIFTI]$ curl -u username "https://xnat.sydney.edu.au/data/JSESSION/"

...

100 22.8M    0 22.8M    0     0  5513k      0 --:--:--  0:00:04 --:--:-- 5514k



5. User can generate a user-access token which is a temporary username and password to logon via RESTAPI or XNAT Upload Assistant

5.1 use command line to get the XNAT temporary username and password

mbp:$ curl -u username "https://test.xnat.sydney.edu.au/data/services/tokens/issue"

Enter host password for user 'username':

{"secret":"gPlzgvaPip6oDGAlJXLypLHBKW3HVbriBSCIZVJcZPic90KDrFkaeMdfefsasef","estimatedExpirationTime":1526514625443,"alias":"451a00c9-441d-4674-84b3-baafb5ab1122","xdatUserId":"username","singleUse":false,"id":3,"disabled":0,"created":1526341825056,"enabled":true,"timestamp":1526341825056}

"alias" follows the temporary username

"secrect" follows the temporary password

mbp:$ curl -u 451a00c9-441d-4674-84b3-baafb5ab1122  "https://test.xnat.sydney.edu.au/data/archive/projects"

Enter host password for user 451a00c9-441d-4674-84b3-baafb5ab1122:

{"ResultSet":{"Result":[{"pi_firstname":"","secondary_ID":"ForeFront","pi_lastname":"","name":"ForeFront Ageing and Neurodegeneration","description":"","ID":"FF","URI":"/data/projects/FF"}], "totalRecords": "1"}}


5.2 use Web Browswer to get the XNAT temporary username and password




Reference

https://wiki.xnat.org/docs16/4-developer-documentation/using-the-xnat-rest-api

...