Subject Resource API
Get A Listing Of Resource Folders Stored With A Subject
GET - /data/projects/{project-id}/subjects/{subject-id | subject-label}/resources
Parameters
{project-id} | Required path parameter |
---|---|
{subject-id} or {subject-label} | Required path parameter |
format | Optional querystring parameter. Specify the format of the returned response.
|
sortBy | Optional querystring parameter: Sort the returned results by one or more parameters in the Result array. Multiple parameters can be provided, separated by commas. |
Response
This call returns an array of resource descriptors, where the key values are "xnat_abstractresource_id" and "label", which can be used as a path parameter.
{
"ResultSet": {
"Result": [
{
"file_count": "integer",
"xnat_abstractresource_id": "integer {resource-id}",
"cat_desc": "string",
"cat_id": "",
"format": "string",
"label": "string {resource-label}",
"category": "resources",
"element_name": "xnat:resourceCatalog",
"file_size": "integer (bytes)",
"content": "",
"tags": ""
}
],
"totalRecords": "integer",
"title": "Resources"
}
}
Get A Listing Of Resource Files Stored With A Subject
GET - /data/projects/{project-id}/subjects/{subject-id | subject-label}/files
Parameters
{project-id} | Required path parameter |
---|---|
{subject-id} or {subject-label} | Required path parameter |
format | Optional querystring parameter. Specify the format of the returned response.
|
sortBy | Optional querystring parameter: Sort the returned results by one or more parameters in the Result array. Multiple parameters can be provided, separated by commas. |
Response
{
"ResultSet": {
"Columns": [
{
"key": "URI",
"serverRoot": ""
}
],
"Result": [
{
"file_content": "",
"Size": "integer",
"file_tags": "",
"cat_ID": "integer {resource-id}",
"digest": "hash",
"collection": "string {resource-label}",
"URI": "/data/projects/{project-id}/subjects/{subject-id}/resources/{resource-id}/files/{filename}",
"file_format": "",
"Name": "string {filename}"
},
...
],
"title": "Files"
}
}
Get The Contents Of A Subject Resource File
GET - /data/projects/{project-id}/subjects/{subject-id | subject-label}/resources/{resource-id | resource-label}/files/{filename}
Parameters
{project-id} | Required path parameter |
---|---|
{subject-id} or {subject-label} | Required path parameter |
{resource-id} or {resource-label} | Required path parameter |
{filename} | Required path parameter |
Response: Success (200) returns the file contents in its native format.
Create A New Subject Resource Folder
Note: {resource-label} must be new and unique in this subject. Once created, resource descriptors cannot be modified.
PUT - /data/projects/{project-id}/subjects/{subject-id | subject-label}/resources/{resource-label}
Parameters
{project-id} | Required path parameter |
---|---|
{subject-id} or {subject-label} | Required path parameter |
{resource-label} | Required path parameter. Specify the name of the resource file |
format | Optional querystring parameter. Specify a string format descriptor for this resource folder. |
tags | Optional querystring parameter. Specify a comma-separated list of tags for this resource folder. |
content | Optional querystring parameter. Specify a string description of the resource folder's content. |
Response: none
Upload A New Subject Resource File
PUT - /data/projects/{project-id}/subjects/{subject-id | subject-label}/resources/{resource-id | resource-label}/files/{filename}
Parameters
{project-id} | Required path parameter |
---|---|
{subject-id} or {subject-label} | Required path parameter |
{resource-id} or {resource-label} | Required path parameter |
{filename} | Required path parameter. This will be the name of the file as it is stored in XNAT. It can be different from the original name of your uploaded file. |
inbody=true | Optional querystring parameter. Use if including the file in the body of the request as opposed to part of a multi-part form data |
file | Required body parameter. |
format | Optional querystring parameter. Specify a string format descriptor for this resource folder. |
content | Optional querystring parameter. Specify a string description of the resource folder's content. |
Response: none
Update An Existing Resource File
POST - /data/projects/{project-id}/subjects/{subject-id | subject-label}/resources/{resource-id | resource-label}/files/{filename}?overwrite=true
Parameters
{project-id} | Required path parameter |
---|---|
{subject-id} or {subject-label} | Required path parameter |
{resource-id} or {resource-label} | Required path parameter. |
{filename} | Required path parameter. This must match an existing file name as it is stored in XNAT. |
overwrite=true | Required querystring parameter. This must be set to allow your new file to overwrite your existing one |
file | Required body parameter |
inbody=true | Optional querystring parameter. Use if including the file in the body of the request as opposed to part of a multi-part form data |
Response: none
Delete A Subject Resource Folder
This URI also permanently deletes all contents of a resource folder
DELETE - /data/projects/{project-id}/subjects/{subject-id | subject-label}/resources/{resource-id | resource-label}
Parameters
{project-id} | Required path parameter |
---|---|
{subject-id} or {subject-label} | Required path parameter |
{resource-id} or {resource-label} | Required path parameter |
Response: none
Delete A Subject Resource File
DELETE - /data/projects/{project-id}/subjects/{subject-id | subject-label}/resources/{resource-id | resource-label}/files/{filename}
Parameters
{project-id} | Required path parameter |
---|---|
{subject-id} or {subject-label} | Required path parameter |
{resource-id} or {resource-label} | Required path parameter |
{filename} | Required path parameter |
Response: none