Skip to main content
Skip table of contents

Project Resources and Files API

Get A Listing Of Resource Folders Stored With A Project

CODE
GET - /data/projects/{project-id}/resources

Parameters

{project-id}

Required path parameter

format

Optional querystring parameter. Specify the format of the returned response.

  • json (default)

  • html

  • xml

  • csv

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

CODE
{
    "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 Project

CODE
GET - /data/projects/{project-id}/files

Parameters

{project-id}

Required path parameter

format

Optional querystring parameter. Specify the format of the returned response.

  • json (default)

  • html

  • xml

  • csv

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

CODE
{
    "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}/resources/{resource-id}/files/{filename}",
                "file_format": "",
                "Name": "string {filename}"
            }
        ],
        "title": "Files"
    }
}

Get The Contents Of A Project Resource File

CODE
GET - /data/projects/{project-id}/resources/{resource-id | resource-label}/files/{filename}

Parameters

{project-id}

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 Project Resource Folder

CODE
PUT - /data/projects/{project-id}/resources/{resource-label}

Parameters

{project-id}

Required path parameter

{resource-label}

Required path parameter

Response: none


Upload A New Project Resource File

CODE
PUT - /data/projects/{project-id}/resources/{resource-id | resource-label}/files/{filename}

Parameters

{project-id}

Required path parameter

{resource-id} or {resource-label}

Required path parameter

{filename}

Required path parameter

inbody=true

Required querystring parameter (if including the file in the body of the request)

file

Required body parameter.

Response: none

Delete A Project Resource Folder

This URI also permanently deletes all contents of a resource folder

CODE
DELETE - /data/projects/{project-id}/resources/{resource-id | resource-label}

Parameters

{project-id}

Required path parameter

{resource-id} or {resource-label}

Required path parameter

Response: none

Delete A Project Resource File

CODE
DELETE - /data/projects/{project-id}/resources/{resource-id | resource-label}/files/{filename}

Parameters

{project-id}

Required path parameter

{resource-id} or {resource-label}

Required path parameter

{filename}

Required path parameter

Response: none

JavaScript errors detected

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

If this problem persists, please contact our support.