Skip to main content

Marking a file as deleted

To mark a file as deleted (or, conversely, to restore a deleted file) we set the <sitebuilder:deleted> element. This allows us to perform Sitebuilder two-stage deletes, where a file can be deleted but not purged (the Atom Publishing Protocol DELETE method actually purges the file, see Purging a 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">
  <sitebuilder:deleted>true</sitebuilder:deleted>
</entry>

With this saved as deletepage.atom:

mat@augustus:~$ curl -i -X PUT --data-binary @deletepage.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 11:52:16 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:51:56Z</updated>
  <published>2011-03-22T11:51:56Z</published>
  <sitebuilder:page-name>exam_results.pdf</sitebuilder:page-name>
  <sitebuilder:searchable>true</sitebuilder:searchable>
  <sitebuilder:visible>true</sitebuilder:visible>
  <sitebuilder:deleted>true</sitebuilder:deleted>
  <sitebuilder:description>A changed ATOM description</sitebuilder:description>
  <sitebuilder:keywords>api tests, atom, file, changed</sitebuilder:keywords>
</entry>  

This is identical to the response for changing file properties. If we set <sitebuilder:deleted> to true, we can restore a deleted file.