Lab 6 - Using the Google Docs API

Deadline Extended to Friday, 10/16 11:59PM

Due - Friday, October 16, 2009

The goal of this lab is to give you some practice using existing web services. You will integrate a client component into your sync application that will (1) authenticate the user with Google; (2) enable a user to view the content stored in his/her Google Documents account; and (3) enable a user to upload files from the local machine to his/her Google Documents.


  1. In order to begin using your service, a user must first authenticate using his/her Google account information.  Google provides three different Authentication Services.  You should use either the Authentication for Installed Applications method or the AuthSub method.  Though the Federated Login + OAuth is a better choice, this option requires you to register your service with Google.

  2. During the authentication process, your service will obtain a token from Google.  You will need to associate that token with the appropriate user and use it in future requests to access the user's Google Services (e.g., Google Docs).  It is recommended that you set a cookie containing the token.

View Google Docs Content

  1. If the user visits gdocs/xml/filelist or gdocs/html/filelist your site will return a list of all documents the user has available in his/her Google Documents account.  You may implement this in one of two ways:
    1. Option 1: Each time the user makes a request to view his/her Google Documents data, your server makes a request to Google, retrieves the result, and translates it into an appropriate format to return to the user.  WIth this option, you may or may not choose to save the result set in your XML Data Store.  With this option, the user cannot view his/her Google Documents information if Google is not available.
    2. Option 2: Implement a thread that periodically retrieves a user's Google Documents data and caches the information in the XML Data Store.  When the user makes a request to view his/her Google Documents data, return the cached copy of the data found in the XML Data Store.  The drawback of this approach is that the information may be stale, but the response time will be better than Option 1.

Upload to Google Docs

  1. For each file, a user may choose the option to "Upload to Google Docs" (using a button or link).
  2. If the user selects "Upload to Google Docs", the content of the desired file will be uploaded to the user's Google Docs account. You can choose whether to keep the name of the file the same as the name on the local file system, or provide the user with the option of changing the name.


  • 30 points for login
  • 30 points for view docs
  • 30 points for upload
  • 10 points for code design and documentation
Refer to the Submission Instructions.  In addition, make sure you do not hardcode any parameters that will change when running your program in a different environment.  For example, you should not hard code "C:\\bob's computer\my directory" as your root directory, as I will not be running your program on "bob's computer".  You may use a configuration file if you feel it is appropriate, and provide sufficient README instructions for changing necessary parameters.

Due 3:30PM - Friday, October 16, 2009

Note: No portion of your code may be copied from any other source including another text book, a web page, or another student (current or former). You must provide citations for any sources you have used in designing and implementing your program.