Project 1a

Due Date: Mon 31 Jan


  • Installation of and familiarity with required software and hosted services
  • An understanding of the HTTP protocol and ReSTful web services
  • Initial experiments with the client's perspective on web services
  • An understanding of hosted, NoSQL databases



cURL is a command-line data transfer tool that supports HTTP, among several other common protocols. Therefore, it can play the role of a command-line web user agent (commonly called browser) or universal web service client.

You should set up cURL in at least one of the following ways:
  • It should be installed by default on Mac OS X.
  • Install using the package management system for your platform, e.g., sudo apt-get install curl ca-certificates on Ubuntu.
  • Download an appropriate version for your platform with SSL support.
  • Use it remotely by logging on to one of the departmental hosts, or

Mercurial (hg)

Mercurial (hg) is a distributed version control system. You will use it to access the examples for this course and, depending on your repository choice for project 0, to manage your group's projects. You should set it up in at least one of the ways mentioned above for cURL. For more background, take a look at this article.

CouchDB instance creation

Create a free hosted CouchDB instance for your group here.

Interaction with database

This is the main part of the project. Please refer to this section of the CouchDB guide and these notes. Unless indicated otherwise, use cURL to interact with the REST API of your instance. Record your interactions using the Unix script command or some other suitable mechanism.
  • Create a database within your CouchDB instance.
  • Obtain a list of all your databases.
  • Create an API key for the database. (After creating the database, go back to the web interface, navigate to your database, and press "permissions". At the bottom, you will see how to create an API key and set permissions for it. Be sure to write down the password somewhere else.)
  • Give the API key write permission. Use the API key and password for the remaining steps; these serve as credentials (userid and password) whenever HTTP basic authentication is required.
  • Add several documents to the database, with the following structure suitable for representing colored points: { "x": 3, "y": 7, "color": "green" }. Use different values for the documents' variables.
    • Add two documents to the database using the PUT method; the ID of the document is under your control.
    • Add two more documents to the database using the POST method; the ID of the document is under the control of the parent resource (i.e., your database).
  • Obtain a list of all your point documents.
  • Update (change) one of the documents you created using PUT.
  • Read the changed document.


Please submit the script file from your interaction with the CouchDB instance in a folder named project1a in your shared group repository. Do not worry about the control sequences contained in the script file because they can be filtered systematically.