Skip to main content Skip to navigation

Working with pages and files

The officially supported API for creating, editing and deleting pages and files is the Atom Publishing ProtocolLink opens in a new window. Each Sitebuilder page (like /services/its, or /fac/sci/chemistry, and every page beneath that, and every page beneath that) is an Atom Collection of files and sub-pages, which are in themselves Collections). The Atom Publishing Protocol (APP) is a RESTful API, which means the HTTP Method sent determines the type of the request. GET returns current information about the page (listing the pages under a page or returning the Atom representation of a page); PUT replaces the current content of a page with new content (editing pages, replacing files); POST creates a new page or file (creating pages, uploading files); DELETE purges the page or file.

IBM have a tutorial on the Atom Publishing ProtocolLink opens in a new window with examples for a general-case APP endpoint.

The APP service document for a Sitebuilder page is:

https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/atom.htm?page=/your/page/url/here

This contains no useful information bar a link to the collection page for that page, which is the same URL with &type=list on the end:

https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/atom.htm?page=/your/page/url/here&type=list

Sending a GET request to this URL returns a list of <entry> items for each sub-page including information about them and their HTML content, and a <link ref="edit"> pointing to the single entry APP endpoint for that page. For all Sitebuilder pages, this is the same as the previous URL but with the type set to single.

https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/atom.htm?page=/your/page/url/here&type=single

which returns an Atom representation of the page including the HTML and a subset of properties.

The APP service document for a Sitebuilder file is slightly different:

https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/file.htm?page=/your/file/url.jpg

This contains no useful information again, just a link to the single entry APP endpoint (type=single):

https://sitebuilder.warwick.ac.uk/sitebuilder2/edit/atom/file.htm?page=/your/file/url.jpg&type=single

which, as with the API for pages, returns an Atom representation of the file.

In these examples we use two cURL options not seen previously. -X specifies the HTTP Method to use for the operation (described in the first paragraph of this page), and --data-binary specifies a local file to use for the data to send to the server - we use this to specify the file to upload, or the Atom representation of the page. We also use -H to send HTTP Headers.

Examples

Name Description
Creating a new page Using the Sitebuilder API to create a new page.
Editing page content Using the Sitebuilder API to edit the content of a page.
Changing page properties Using the Sitebuilder API to change page properties.
Marking a page as deleted Using the Sitebuilder API to mark a page as deleted.
Purging a page Using the Sitebuilder API to purge a page.
Uploading a file Using the Sitebuilder API to upload a file.
Replacing the contents of a file Using the Sitebuilder API to replace the contents of a file.
Changing file properties Using the Sitebuilder API to change file properties.
Marking a file as deleted Using the Sitebuilder API to mark a file as deleted.
Purging a file Using the Sitebuilder API to purge a file.