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

...

The reason for using this method is in the AAF, there wont be a "permanent“ username and password. But in order for us to use the AAF with RESTAPI credentials, Chapter 4 and Chapter 5.

4.1 Get 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.

...

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

4.1.1 Get the SESSION Number via curl command line

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

...

628EE7A19C8B9CEF7AE46E3744F6CXX

4.1.2 Get the SESSION Number via Web interface

Just logon the URL://data/JSESSION

Image Added

List the project

[unikey@login2 NIFTI]$curl --cookie JSESSIONID=628EE7A19C8B9CEF7AE46E3744F6CXX https://xnat.sydney.edu.au/data/projects

...

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

...

The Chapter 4 mentioned a way to use JSESSION ID to logon to XNAT. But if we are to use software such as XNAT Upload Assistant, we might still need to put in the username and password. Below outlines how we can get a temporary username and password from XNAT. 

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"

...

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

Logon to https://URL/data/services/tokens/issue

Image Added

alias: is the temporary username. (temporary username will be reset for every 6 hours)

secret: is the passwrod

mbp:$ curl -u 451a00c9-441d-4674-84b3-baafb5ab1122  "https://URL/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"}}

Reference

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

...