Skip to main content
Skip table of contents

Resource Quarantine API

This set of API endpoints can be used by project owners or site administrators to triage resource files that have been uploaded and stored in a resource quarantine. See Using the Resource File Quarantine for details. 

Contents


Get a List of Quarantined Resources in a Project

CODE
GET - /data/services/triage/projects/{PROJECT_ID}

Parameters:

ParameterDescriptionParameter TypeData Type
Project_IDThe ID of the project whose quarantine you want to querypathstring

Response:

The result is a JSON-formatted list of resource collections organized by user and data object. For example, if a user uploads three files to a Subject, those three files are quarantined in a single collection. However, if the same user uploads an additional file to an image session, that upload will be located in a separate resource collection in the quarantine. Here is an example JSON structure for multiple files in a single collection.

CODE
{
  "ResultSet": {
    "Columns": [
      {
        "key": "URI",
        "serverRoot": ""
      },
      {
        "key": "TARGET",
        "serverRoot": ""
      }
    ],
    "Result": [
      {
        "TARGET": "/data/archive/projects/T1109_1_bRZFHY/subjects/XNAT_S00003/resources/TestingFolder4/files",
        "DATE": "2021-04-22 07:56:29",
        "FTARGET": "<b>Project<\/b>: T1109_1_bRZFHY<br><b>Subject<\/b>: T1109_1_E810A<br><b>Resource<\/b>: TestingFolder4",
        "OVERWRITE": "false",
        "FSOURCE": "test1.json<br>",
        "Resource": "1619096148184",
        "format": "",
        "USER": "admin",
        "URI": "/data/services/triage/projects/T1109_1_bRZFHY/resources/1619096148184",
        "content": "",
        "EVENT_REASON": ""
      },
      {
        "TARGET": "/data/archive/projects/T1109_1_bRZFHY/subjects/XNAT_S00003/resources/TestingFolder4/files",
        "DATE": "2021-04-22 07:56:29",
        "FTARGET": "<b>Project<\/b>: T1109_1_bRZFHY<br><b>Subject<\/b>: T1109_1_E810A<br><b>Resource<\/b>: TestingFolder4",
        "OVERWRITE": "false",
        "FSOURCE": "test2.json<br>",
        "Resource": "1619096148184",
        "format": "",
        "USER": "admin",
        "URI": "/data/services/triage/projects/T1109_1_bRZFHY/resources/1619096148184",
        "content": "",
        "EVENT_REASON": ""
      }
    ],
    "totalRecords": "2"
  }
}

The resource JSON contains all of the elements for each file that will be necessary to approve the file using the POST command in these documents. The "URI" and "TARGET" parameters in this JSON structure get mapped to the "src" and "dest" parameters required by the approval form.

Adding a File to the Resource Quarantine

CODE
POST - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}/files/{FILE_NAME}

Parameters:

ParameterDescriptionParameter Type Data Type
PROJECT_IDThe ID of the project whose quarantine you want to querypathstring
RESOURCE_IDThe ID of the resource we are uploading topathstring
FILE_NAMEThe name of the file we are uploadingpathstring
targetdestination URI of the file once approvedquerystring
extractExtract compressed filesqueryboolean
OVERWRITE

Overwrite existing files in quarantine with the same name

queryboolean

Response:

HTTP 200 - Files were uploaded successfully 

Download a File from the Resource Quarantine

CODE
GET - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}/files/{FILE_NAME}

Parameters

ParameterDescriptionParameter TypeData Type
PROJECT_IDThe ID of the project whose quarantine you want to querypathstring
RESOURCE_IDThe ID of the resource where the files arepathstring
FILE_NAMEThe file we want to downloadpathstring

Response:

HTTP 200 - The file is downloaded


Download all Files from a Resource within the Resource Quarantine

CODE
GET - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}/files

Parameters

ParameterDescriptionParameter TypeData Type
PROJECT_IDThe ID of the project whose quarantine you want to querypathstring
RESOURCE_IDThe ID of the resource we want to downloadpathstring
formatThe format of the download (zip, tar.gz, tar)querystring

Response:

HTTP 200 - A compressed zip containing all the files in the quarantined resource


Approve a File in the Resource Quarantine

CODE
POST - /data/services/triage/approve

Parameters:

ParameterDescriptionParameter TypeData Type
srcThe current quarantined URI of the fileform datastring
destThe destination URI of the fileform datastring
overwriteOverwrite existing files that match in the destination directoryform databoolean

Response:

HTTP 201 - File was successfully approved and moved into the destination location.

Remove a File from the Resource Quarantine

CODE
DELETE - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}/files/{FILE_NAME}

Parameters:

ParameterDescriptionParameter TypeData Type
PROJECT_IDThe ID of the project whose quarantine you want to querypathstring
RESOURCE_IDThe ID of the resource where the files arepathstring
FILE_NAMEThe file we want to deletepathstring

Response:

HTTP 200 - File was successfully deleted

Remove all Files from a Resource within the Resource Quarantine

CODE
DELETE - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}

Parameters:

ParameterDescriptionParameter TypeData Type
PROJECT_IDThe ID of the project whose quarantine you want to querypathstring
RESOURCE_IDThe ID of the resource we want to deletepathstring

Response:

HTTP 200 - Resource was successfully deleted

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.