Skip to main content Skip to navigation

Changing file properties

To edit the properties of a file, we send a PUT request to the endpoint for the Atom representation of the file itself. The easiest way to see what properties can be changed is to send a GET to the same endpoint:

mat@augustus:~$ curl -i -X GET -u cuscav
   "https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/file.htm?page=/fac/sci/chemistry/exam_results.pdf&type=single"
Enter host password for user 'cuscav':

HTTP/1.1 200 OK
Date: Tue, 22 Mar 2011 11:34:41 GMT
Server: Penny
Content-Type: application/atom+xml;charset=ISO-8859-1
Content-Length: 1124
Vary: User-Agent

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sitebuilder="http://go.warwick.ac.uk/elab-schemas/atom">
  <title>Exam Results</title>
  <link rel="collection" 
    href="https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/atom.htm?page=/fac/sci/chemistry/exam_results.pdf&type=list" />
  <link rel="edit" 
    href="https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/atom.htm?page=/fac/sci/chemistry/exam_results.pdf&type=single" />
  <link rel="alternate" 
    href="http://www2.warwick.ac.uk/fac/sci/chemistry/exam_results.pdf" />
  <id>urn:uuid:094d43ed2eb4e0ce012edd5517ba3ac8</id>
  <author>
    <name>Mathew Mannion</name>
  </author>
  <updated>2011-03-22T11:31:04Z</updated>
  <published>2011-03-22T11:31:04Z</published>
  <sitebuilder:page-name>exam_results.pdf</sitebuilder:page-name>
  <sitebuilder:searchable>true</sitebuilder:searchable>
  <sitebuilder:visible>false</sitebuilder:visible>
  <sitebuilder:deleted>false</sitebuilder:deleted>
  <sitebuilder:description>A test of the ATOM representation of a file</sitebuilder:description>
  <sitebuilder:keywords>api tests, atom</sitebuilder:keywords>
</entry>  

The properties that can be changed are:

  • <title> - the link caption for the file
  • <sitebuilder:searchable> - whether the file is visible in search engines
  • <sitebuilder:visible> - whether the file is visible in the navigation list of its parent page
  • <sitebuilder:deleted> - whether the file is marked as deleted (see Marking a file as deleted)
  • <sitebuilder:description> - the file's description, used for search engines and in other Sitebuilder pages
  • <sitebuilder:keywords> - keywords, used for search optimisation and categorisation
  • <sitebuilder:page-order> - the order of the file in local navigation

To set these properties, we simply need to set their values in an Atom document and PUT them to the Atom representation of the file:

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sitebuilder="http://go.warwick.ac.uk/elab-schemas/atom">
  <title>Exam Results 2011</title>
  <sitebuilder:searchable>true</sitebuilder:searchable>
  <sitebuilder:visible>true</sitebuilder:visible>
  <sitebuilder:description>A changed ATOM description</sitebuilder:description>
  <sitebuilder:keywords>api tests, atom, file, changed</sitebuilder:keywords>
</entry>

With this saved as editproperties.atom:

mat@augustus:~$ curl -i -X PUT --data-binary @editfileproperties.atom -H 'Content-Type: application/atom+xml' -u cuscav
   "https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/file.htm?page=/fac/sci/chemistry/exam_results.pdf&type=single"
Enter host password for user 'cuscav':

HTTP/1.1 200 OK
Date: Tue, 22 Mar 2011 10:58:59 GMT
Server: Penny
Content-Type: application/atom+xml;charset=ISO-8859-1
Content-Length: 1123
Vary: User-Agent

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:sitebuilder="http://go.warwick.ac.uk/elab-schemas/atom">
  <title>Exam Results 2011</title>
  <link rel="collection" 
    href="https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/atom.htm?page=/fac/sci/chemistry/exam_results.pdf&type=list" />
  <link rel="edit" 
    href="https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/atom.htm?page=/fac/sci/chemistry/exam_results.pdf&type=single" />
  <link rel="alternate" 
    href="http://www2.warwick.ac.uk/fac/sci/chemistry/exam_results.pdf" />
  <id>urn:uuid:094d43ed2eb4e0ce012edd5517ba3ac8</id>
  <author>
    <name>Mathew Mannion</name>
  </author>
  <updated>2011-03-22T11:31:04Z</updated>
  <published>2011-03-22T11:31:04Z</published>
  <sitebuilder:page-name>exam_results.pdf</sitebuilder:page-name>
  <sitebuilder:searchable>true</sitebuilder:searchable>
  <sitebuilder:visible>true</sitebuilder:visible>
  <sitebuilder:deleted>false</sitebuilder:deleted>
  <sitebuilder:description>A changed ATOM description</sitebuilder:description>
  <sitebuilder:keywords>api tests, atom, file, changed</sitebuilder:keywords>
</entry>