Tuesday, June 6. 2006
Mozilla Update Check is RESTful
Trackbacks
Trackback specific URI for this entry
No Trackbacks
I found a neat little surprise the other day. It appears that the Mozilla extension auto update feature is RESTful; I found this out through the use of LiveHTTPHeaders. Whenever you have an extension like Spellbound or Firebug, Firefox will call home to a server, and perform a version check, comparing your version with the latest version it has. It is not 100% RESTful, the biggest problem being that there is an end-point style URI (https://addons.mozilla.org/update/VersionCheck.php) with a query string (reqVersion=1&id=firebug@software.joehewitt.com...) ideally, the uri would be something like /update/VersionCheck.php/1/firebug.software.joehewitt.com/... giving each unique identifier its own space on the URI.
Beyond that however, it is very good use of HTTP, all the information needed is encapsulated in the request and is stateless. Really this shows that a lot of simple web services are either inherently RESTful, or are just a hop skip and jump away from being a true rest webservice.
This is the important thing about REST webservices. It is not that you need to conform to a "REST Standard", but instead you conform to the HTTP spec and end up, by design, following at least some of the REST constraints.
For reference (and the truly geeky) , here is the request and response:
https://addons.mozilla.org/update/VersionCheck.php?reqVersion=1&id=firebug@software.joehewitt.com&version=0.4&maxAppVersion=3.0&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=1.5.0.3&appOS=WINNT&appABI=x86-msvc
GET /update/VersionCheck.php?reqVersion=1&id=firebug@software.joehewitt.com&version=0.4&maxAppVersion=3.0&appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}&appVersion=1.5.0.3&appOS=WINNT&appABI=x86-msvc HTTP/1.1
Host: addons.mozilla.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en,en-us;q=0.7,ja;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cache-Control: no-cache
HTTP/1.x 200 OK
Content-Length: 939
Connection: close
Content-Type: text/xml; charset=utf-8
<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<RDF:Description about="urn:mozilla:extension:firebug@software.joehewitt.com">
<em:updates>
<RDF:Seq>
<RDF:li resource="urn:mozilla:extension:firebug@software.joehewitt.com:0.4"/>
</RDF:Seq>
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:firebug@software.joehewitt.com:0.4">
<em:version>0.4</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.5</em:minVersion>
<em:maxVersion>3.0</em:maxVersion>
<em:updateLink>http://releases.mozilla.org/pub/mozilla.org/extensions/firebug/firebug-0.4-fx+fl.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:RDF>

