API
Get the data you want simply by constructing your URLs as follows:
Return data for a postcode
http://www.uk-postcodes.com/postcode/[postcode (no space)].['xml', 'csv', 'json'* or 'rdf']
Return data for the nearest postcode to a point
http://www.uk-postcodes.com/latlng/[latitude],[longitude].['xml', 'csv', 'json'* or 'rdf']
Return data for postcodes within x distance (miles) of a postcode or lat/lng
http://www.uk-postcodes.com/distance.php?postcode=[postcode]&distance=[distance in miles]&format=[xml|csv|json]
http://www.uk-postcodes.com/distance.php?lat=[latitude]&lng=[longitude]&distance=[distance in miles]&format=[xml|csv|json]
That's it! Be nice to the server and cache your requests!
* If using JSON, add '?callback=[some function call]' to the url to return JSONP
Helper Libraries
To make things even easier, a bunch of people have built helper libraries to make the process easier. Built one yourself? Drop me a line via Twitter.
- Ruby Gem (cleverly called Pat) By Stef Lewandowski
- PHP Function by Stuart Harrison
