Skip to main content Skip to navigation

Listing files and folders

Each folder in Files.Warwick is an Atom Collection, meaning that it can be represented as an Atom feed of files and folders.

Sending a GET request to the Atom endpoint for a folder returns all of the sub-folders and files (sub-folders appear first):

mat@augustus:~$ curl -i -X GET -u cuscav
   "https://files.warwick.ac.uk/files/api/atom/folder?account=mmannion&path=mmannion/Files/"
Enter host password for user 'cuscav':

HTTP/1.1 200 OK
Date: Tue, 05 Mar 2013 18:58:50 GMT
Content-Type: application/atom+xml;charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app"> xmlns:files="http://go.warwick.ac.uk/elab-schemas/files/atom"
  <title>My account -</title>
  <link rel="self" 
    href="https://files.warwick.ac.uk/files/api/atom/folder?account=mmannion&path=mmannion%2FFiles%2F" />
  <link rel="alternate" 
    href="https://files.warwick.ac.uk/mmannion/browse/" />
  <link rel="service" 
    href="https://files.warwick.ac.uk/files/api/atom/service" />
  <author>
    <name>Mathew Mannion</name>
  </author>
  <id>https://files.warwick.ac.uk/mmannion/browse/</id>
  <updated>2013-03-05T15:02:24.658Z</updated>
  <entry>
    <title>My new folder name</title>
    <link rel="collection" 
      href="https://files.warwick.ac.uk/files/api/atom/folder?account=mmannion&path=mmannion%2FFiles%2FMy+new+folder+name%2F" />
    <link rel="edit" 
      href="https://files.warwick.ac.uk/files/api/atom/node?account=mmannion&path=mmannion%2FFiles%2FMy+new+folder+name%2F" />
    <link rel="edit-permissions" 
      href="https://files.warwick.ac.uk/files/api/atom/permissions?account=mmannion&path=mmannion%2FFiles%2FMy+new+folder+name%2F" />
    <link rel="alternate" 
      href="https://files.warwick.ac.uk/mmannion/browse/My+new+folder+name" />
    <id>https://files.warwick.ac.uk/mmannion/browse/My+new+folder+name</id>
    <updated>2013-03-05T15:02:24.658Z</updated>
    <published>2013-03-05T15:02:24.658Z</published>
    <app:edited>2013-03-05T15:02:24.658Z</app:edited>
    <author>
      <name>Mathew Mannion</name>
    </author>
    <summary type="text">My new folder name/</summary>
    <files:size>25053908</files:size>
    <files:files>10</files:files>
    <files:folders>2</files:folders>
  </entry>
  <entry>
    <title>Exam Results.pdf</title>
    <link rel="edit" href="https://files.warwick.ac.uk/files/api/atom/node?account=mmannion&path=mmannion%2FFiles%2FExam+Results.pdf"/>
    <link rel="edit-permissions" href="https://files.warwick.ac.uk/files/api/atom/permissions?account=mmannion&path=mmannion%2FFiles%2FExam+Results.pdf"/>
    <link rel="edit-media" href="https://files.warwick.ac.uk/files/api/atom/media?account=mmannion&path=mmannion%2FFiles%2FExam+Results.pdf"/>
    <link rel="alternate" type="application/pdf" href="https://files.warwick.ac.uk/mmannion/files/Exam+Results.pdf"/>
    <content type="application/pdf" src="https://files.warwick.ac.uk/mmannion/files/Exam+Results.pdf"/>
    <id>https://files.warwick.ac.uk/mmannion/files/Exam+Results.pdf</id>
    <updated>2013-03-05T16:38:34.971Z</updated>
    <published>2013-03-05T16:38:35.023Z</published>
    <app:edited>2013-03-05T16:38:34.971Z</app:edited>
    <author>
      <name>Mathew Mannion</name>
    </author>
    <summary type="text">Exam Results.pdf</summary>
    <files:mimetype>application/pdf</files:mimetype>
    <files:size>11923854</files:size>
    <files:antivirus>
      <files:checking>false</files:checking>
      <files:checked>true</files:checked>
      <files:hasvirus>false</files:hasvirus>
    </files:antivirus>
  </entry>
  ... etc ...
</feed>  
  • Folders have a link rel="collection" that points to the Atom feed representing the collection of files/sub-folders in that folder
  • Files have a link rel="edit-media" for overwriting their content
  • Both files and folders have a link rel="edit-permissions" for viewing the collection of their permissions
  • We specify a Files.Warwick XML Schema at http://go.warwick.ac.uk/elab-schemas/files/atom - this allows us to get Files.Warwick-specific properties. These are always optional
  • Folders have a number of Files.Warwick specific properties:
    • files:size - the total cumulative file size, in bytes, of all files uploaded in this folder or sub-folders of it
    • files:files - the number of files in this folder
    • files:folders - the number of subfolders in this folder
  • Similarly, files have the following properties:
    • files:mimetype - the MIME type of the file
    • files:size - the size, in bytes, of the file
    • files:antivirus - information from the anti-virus service about this file. Contains:
      • files:checking - true if the service is currently checking this file or it is queued to be checked, false otherwise
      • files:checked - true if the service has completed checking this file, false otherwise
      • files:hasvirus - true if the service has detected a virus in this file, false otherwise
      • If both files:checking and files:checked are false, Files.Warwick was unable to check the file