Page tree
Skip to end of metadata
Go to start of metadata

Contents: 



User resources are configured to be stored in the root cache space, defined by default as /data/home/xnat/cache. Cache spaces are not considered to be reliable long-term storage; many XNAT administrators set up cron jobs to clear this space.

A CSRF Token may be required for all PUT, POST and DELETE calls, depending on your Admin UI setting.



Get All User Cache Resources

Returns all resource directories for the currently logged-in user.

GET - /data/user/cache/resources/


Parameters:

format
  • XML (default)
  • JSON
  • HTML
  • CSV

Response:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body>
<table class="x_rs_t" cellpadding="0" cellspacing="0">
    <thead class="x_rs_thead">
        <tr class="x_rs_tr_head">
            <th>Resource</th><th>URI</th>
        </tr>
    </thead>
    <tbody id="dataRows">
        <tr class="x_rs_tr_data odd">
            <td>uploads</td>
            <td><a href='/data/user/cache/resources/uploads'>/data/user/cache/resources/uploads</a></td>
        </tr>
    </tbody>
</table>
</body>
</html>


Create A User Cache Resource Folder

This creates a new folder in the XNAT root cache associated with the currently logged-in user account. The folder naming will use the user's numerical ID, i.e.: /ROOT_CACHE_SPACE/USERS/4/folder_name

PUT - /data/user/cache/resources/{FOLDER}


Parameters:

{FOLDER}Path parameter – the resource ID
formatOptional querystring parameter
contentOptional querystring parameter
tagsOptional querystring parameter

Response:

200OK
412Precondition Failed (Occurs if the user is a guest account)


Get User Cache Resource File Listing

GET - /data/user/cache/resources/{FOLDER}/files

Parameters:

{FOLDER}Path parameter – the resource ID
format
  • XML (default)
  • html
  • json
  • csv

Response:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<body>
    <table class="x_rs_t" cellpadding="0" cellspacing="0">
        <thead class="x_rs_thead">
            <tr class="x_rs_tr_head">
                <th>Name</th><th>Size</th><th>URI</th>
            </tr>
        </thead>
        <tbody id="dataRows">
            <tr class="x_rs_tr_data odd">
                <td>test.txt</td><td>4</td><td><a href='/xnat/data/user/cache/resources/junk/files/test.txt'>/data/user/cache/resources/junk/files/test.txt</a></td>
            </tr>
        </tbody>
    </table>
</body>
</html>


Upload A File To A User Cache Resource

If you are submitting a file via an HTML form, the form must have "multipart/form-data" encoding.

PUT - /data/user/cache/resources/{FOLDER}/files/{FILE}

Parameters:

{FOLDER}Path parameter – the resource ID
{FILE}Path parameter – the filename you wish to save your file as
fileForm data – the file you wish to upload

Response: None


Delete A File From A User Cache Resource

DELETE - /data/user/cache/resources/{FOLDER}/files/{FILE}

Parameters:

{FOLDER}Path parameter – the resource ID
{FILE}Path parameter – the filename you wish to delete
  • No labels