JSON-head, it is not about size - it is about usefulness
Date : 2008 07 29 Category : Tech & DevelopmentSimon Willison is lately having a lot of fun with App Engine and developing small RESTful helper apps for the masses out there. Following JSON Time, a small timezone lookup API over HTTP (showcased at BBC's Mashed earlier this year) he now released JSON head which is what it says on the tin: a HTTP HEAD lookup app that returns a JSON object.
If you for example use the APP with a url parameter like this:
http://json-head.appspot.com/?url=http://www.yahoo.com/&callback=fooYou are going to get a JSON response with a wrapper function called foo:
PLAIN TEXT JAVASCRIPT: foo({ "status_code": 200, "ok": true, "headers": { "Via": "HTTP/1.1 GWA", "Content-Encoding": "gzip", "Accept-Ranges": "bytes", "X-Google-Cache-Control": "remote-fetch", "Vary": "User-Agent", "Last-Modified": "Tue, 29 Jul 2008 16:03:20 GMT", "Connection": "close", "Cache-Control": "private", "Date": "Tue, 29 Jul 2008 16:23:14 GMT", "P3P": "policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"", "Content-Type": "text/html; charset=utf-8", "X-XRDS-Location": "http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds" } })If you try a non-existing URL like:
http://json-head.appspot.com/?url=http://www.yahoo.com/nadaYou'll get the 404 error message in JSON:
PLAIN TEXT JAVASCRIPT: { "status_code": 404, "ok": true, "headers": { "Via": "HTTP/1.1 GWA", "X-Google-Cache-Control": "remote-fetch", "Vary": "User-Agent", "Connection": "close", "Cache-Control": "private", "Date": "Tue, 29 Jul 2008 16:25:31 GMT", "P3P": "policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"", "Content-Type": "text/html; charset=utf-8" } }You could for example use this to write a script that removes links from the document when they are broken.