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
GET - /data/services/triage/projects/{PROJECT_ID}
Parameters:
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
Project_ID | The ID of the project whose quarantine you want to query | path | 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.
{
"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
POST - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}/files/{FILE_NAME}
Parameters:
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
PROJECT_ID | The ID of the project whose quarantine you want to query | path | string |
RESOURCE_ID | The ID of the resource we are uploading to | path | string |
FILE_NAME | The name of the file we are uploading | path | string |
target | destination URI of the file once approved | query | string |
extract | Extract compressed files | query | boolean |
OVERWRITE | Overwrite existing files in quarantine with the same name | query | boolean |
Response:
HTTP 200 - Files were uploaded successfully
Download a File from the Resource Quarantine
GET - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}/files/{FILE_NAME}
Parameters
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
PROJECT_ID | The ID of the project whose quarantine you want to query | path | string |
RESOURCE_ID | The ID of the resource where the files are | path | string |
FILE_NAME | The file we want to download | path | string |
Response:
HTTP 200 - The file is downloaded
Download all Files from a Resource within the Resource Quarantine
GET - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}/files
Parameters
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
PROJECT_ID | The ID of the project whose quarantine you want to query | path | string |
RESOURCE_ID | The ID of the resource we want to download | path | string |
format | The format of the download (zip, tar.gz, tar) | query | string |
Response:
HTTP 200 - A compressed zip containing all the files in the quarantined resource
Approve a File in the Resource Quarantine
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
DELETE - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}/files/{FILE_NAME}
Parameters:
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
PROJECT_ID | The ID of the project whose quarantine you want to query | path | string |
RESOURCE_ID | The ID of the resource where the files are | path | string |
FILE_NAME | The file we want to delete | path | string |
Response:
HTTP 200 - File was successfully deleted
Remove all Files from a Resource within the Resource Quarantine
DELETE - /data/services/triage/projects/{PROJECT_ID}/resources/{RESOURCE_ID}
Parameters:
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
PROJECT_ID | The ID of the project whose quarantine you want to query | path | string |
RESOURCE_ID | The ID of the resource we want to delete | path | string |
Response:
HTTP 200 - Resource was successfully deleted