Skip to main content

Getting Started with the Sitebuilder API

Accessing web pages with cURL

cURL is a command-line HTTP client, much like a web browser but driven with text commands. For example, to get the University's home page, I could use the command:

mat@augustus:~$ curl ""
<title>302 Found</title>
<p>The document has moved <a href="">here</a>.</p>

Note that because I am on campus, the server returns an instruction to send me directly to insite.

By default, curl returns the content of a page from a GET - this is what happens when you type an address into a web browser. If I pass the -i flag to cURL, it will also show me the server headers, and passing -I sends a HEAD instead of a GET - which tells the server I don't care about the contents of the page.

mat@augustus:~$ curl -i -I ""
HTTP/1.1 302 Found
Date: Mon, 21 Mar 2011 17:34:51 GMT
Server: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.7d
Vary: Accept-Encoding
Content-Type: text/html; charset=iso-8859-1  

A slightly more interesting URL to fetch is one of the API endpoints. Sitebuilder provides a JSON (JavaScript Object Notation) API to get information about a page at, where the page parameter is the URL of your Sitebuilder page AFTER the So to get information about the IT Services home page at, we send a GET request as follows:

mat@augustus:~$ curl ""
    "url": "",
    "pageType": "html",
    "linkCaption": "IT Services",
    "shortTitle": "IT Services - Warwick University",
    "pageHeading": "Welcome to IT Services",
    "deleted": false,
    "path": "/services/its",
    "publiclyVisible": true,
    "mimeType": "text/html",
    "properties": {
        "pageOrder": 0,
        "supportsPagesToGo": false,
        "showInLocalNavigation": false,
        "hasThumbnail": false,
        "deferJs": false,
        "widePage": false,
        "allowSearchEngines": true,
        "spanRhs": true,
        "escapeHtml": false
    "keywords": [
        "it services",
        "information technology"
    "siteRoot": "/services/its"

Note that in this example the JSON has been simplified and formatted to make it easier to read. This shows information about the page in a way that a computer program can read, but this only shows publicly visible information. If we try and get information for a protected page, it won't work, so we will need to authenticate to the server to get this.

Using HTTP Basic authentication

Adding &forcebasic=true to the end of any Sitebuilder URL accessed over HTTPS tells Sitebuilder to ask for HTTP Basic authentication. This is a lightweight authentication protocol that requires a username and password to be sent with each request.

In cURL, this is achieved by using the -u parameter to specify a username - cURL then prompts the user for a password. In this example, note how accessing a protected page without these parameters redirects the user to Web sign-on to log in, but works when a username and password is correctly specified.

mat@augustus:~$ curl -i ""
HTTP/1.1 302 Moved Temporarily
Date: Mon, 21 Mar 2011 17:48:26 GMT
Server: Penny
Content-Length: 0
Vary: User-Agent
Content-Type: application/json  
mat@augustus:~$ curl -i -u cuscav
Enter host password for user 'cuscav':
HTTP/1.1 200 OK
Date: Mon, 21 Mar 2011 17:49:19 GMT
Server: Penny
Content-Type: application/json;charset=ISO-8859-1
Content-Language: en-GB
Content-Length: 1552
Vary: User-Agent

{"editedUpdated":{"date":1297850802000,"user":"Emily Harding"},"contentUpdated":...  

Important: Because of the way that HTTP Basic authentication sends an encrypted version of the username and password with every request, it is less secure than standard authentication through web sign-on. As well as this, by their very nature, automated programs require username and passwords to be stored on a computer in such a way that it would be a breach of the Terms and Conditions of IT Services accounts to store your actual ITS usercode and password in this way.

For automated systems that access Sitebuilder APIs, you must use an external user account for API access. You should not share an API account between multiple systems, and you should ensure that each account is granted the minimal permissions it needs to perform its tasks, and only on the pages where it needs to perform these tasks.

Getting an external user account for API access

In order to obtain an external user account for API access, please email webteam at warwick dot ac dot uk