University of Southern California

ITS Web Services


Webcam API


This API provides support for JSON and JSONP listings of our webcam archives (stills and movies). You need to know the webcam name (e.g. tommycam for TommyCam, see list below). Once you know the name you can build a RESTful request for the list of available movies or recent still images.

Getting movie lists

Once you know the name of the webcam (e.g. tommycam) you can get a list of movies available. This list has a uri and day field for each movie. The data is organized something like this:
[
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/movies/tommycam-2009-08-24.mp4',
'day':'August 24, 2009 (Monday)'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/movies/tommycam-2009-08-23.mp4',
'day':'August 23, 2009 (Sunday)'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/movies/tommycam-2009-08-22.mp4',
'day':'August 22, 2009 (Saturday)'}
]
Give it a try at:
http://web-app.usc.edu/ws/webcams/api/tommycam

You may also get JSONP (i.e. JSON with Padding) using the callback option. E.g. TommyCam data in as a JSONP function called MyFunc JSONP would request this way -

http://web-app.usc.edu/ws/webcams/api/tommycam?callback=MyFunc
This would produce something like this:
MyFunct([
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/movies/tommycam-2009-08-24.mp4', 'day':'August 24, 2009 (Monday)'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/movies/tommycam-2009-08-23.mp4', 'day':'August 23, 2009 (Sunday)'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/movies/tommycam-2009-08-22.mp4', 'day':'August 22, 2009 (Saturday)'}
])

To use the JSONP code in your own page you could add some Javascript like this:

<script language="Javascript">
  listTommyCamMovies = function(data) {
    document.write("<ul>");
    for (i in data) {
      document.write("<li><a href='" + data[i].uri + "'>" + data[i].day + "</a></li>");
    }
    document.write("</ul>");
  }
</script>

<script type="text/javascript" src="http://web-app.usc.edu/ws/webcams/api/tommycam?callback=listTommyCam"></script>

This would produce a UL list of movies available with the link text showing the date of the movie.

Getting still image lists

This API also provides a similar list for still images. The list is one row per image with a URL for the still and a timestamp in each row. The URL is formed the same way the movie list is with an added "/stills" to the end. E.g. http://web-app.usc.edu/ws/webcams/api/tommycam/stills would give you a list of the last twenty five still images available from TommyCam. Likewise http://web-app.usc.edu/ws/webcams/api/tommycam/stills?callback=TommyStills would give you the same list formatted as JSONP.

JSON stills example:

[{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155500.jpg', 'timestamp':'Mon, 24 Aug 2009 15:55:00 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155401.jpg', 'timestamp':'Mon, 24 Aug 2009 15:54:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155300.jpg', 'timestamp':'Mon, 24 Aug 2009 15:53:00 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155201.jpg', 'timestamp':'Mon, 24 Aug 2009 15:52:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155100.jpg', 'timestamp':'Mon, 24 Aug 2009 15:51:00 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155001.jpg', 'timestamp':'Mon, 24 Aug 2009 15:50:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-154901.jpg', 'timestamp':'Mon, 24 Aug 2009 15:49:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-154801.jpg', 'timestamp':'Mon, 24 Aug 2009 15:48:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-154701.jpg', 'timestamp':'Mon, 24 Aug 2009 15:47:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-154601.jpg', 'timestamp':'Mon, 24 Aug 2009 15:46:01 -0700'}
]

JSONP stills output example:

TommyStills([{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155500.jpg', 'timestamp':'Mon, 24 Aug 2009 15:55:00 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155401.jpg', 'timestamp':'Mon, 24 Aug 2009 15:54:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155300.jpg', 'timestamp':'Mon, 24 Aug 2009 15:53:00 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155201.jpg', 'timestamp':'Mon, 24 Aug 2009 15:52:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155100.jpg', 'timestamp':'Mon, 24 Aug 2009 15:51:00 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-155001.jpg', 'timestamp':'Mon, 24 Aug 2009 15:50:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-154901.jpg', 'timestamp':'Mon, 24 Aug 2009 15:49:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-154801.jpg', 'timestamp':'Mon, 24 Aug 2009 15:48:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-154701.jpg', 'timestamp':'Mon, 24 Aug 2009 15:47:01 -0700'},
{'uri':'http://web-app.usc.edu/info/www/ws/webcams/images/tommycam/tommycam-20090824-154601.jpg', 'timestamp':'Mon, 24 Aug 2009 15:46:01 -0700'}
])

Available WebCams