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. 

Get a List of Quarantined Resources in a Project

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

Parameters:

Parameter

Description

Data Type

Project_ID

Required path parameter: The ID of the project whose quarantine you want to query

string

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:

Parameter

Description

Data Type

PROJECT_ID

Required path parameter: The ID of the project whose quarantine you want to query

string

RESOURCE_ID

Required path parameter: The ID of the resource we are uploading to

string

FILE_NAME

Required path parameter: The name of the file we are uploading

string

target

Query parameter: destination URI of the file once approved

string

extract

Optional query parameter: Extract compressed files

boolean

OVERWRITE

Optional query parameter: Overwrite existing files in quarantine with the same name

boolean

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

Parameter

Description

Data Type

PROJECT_ID

Required path parameter: The ID of the project whose quarantine you want to query

string

RESOURCE_ID

Required path parameter: The ID of the resource where the files are

string

FILE_NAME

Required path parameter: The file we want to download

string

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

Parameter

Description

Data Type

PROJECT_ID

Required path parameter: The ID of the project whose quarantine you want to query

string

RESOURCE_ID

Required path parameter: The ID of the resource we want to download

string

format

Optional query parameter: The format of the download (zip, tar.gz, tar)

string

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:

Parameter

Description

Parameter Type

Data Type

src

The current quarantined URI of the file

form data

string

dest

The destination URI of the file

form data

string

overwrite

Overwrite existing files that match in the destination directory

form data

boolean

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:

Parameter

Description

Data Type

PROJECT_ID

Required path parameter: The ID of the project whose quarantine you want to query

string

RESOURCE_ID

Required path parameter: The ID of the resource where the files are

string

FILE_NAME

Required path parameter: The file we want to delete

string

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:

Parameter

Description

Data Type

PROJECT_ID

Required path parameter: The ID of the project whose quarantine you want to query

string

RESOURCE_ID

Required path parameter: The ID of the resource we want to delete

string

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.