Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated documentation for new outcode route

Updated home page for new outcode route
Added method to lookup outcode
  • Loading branch information...
commit 7aa4df0110bb3744d6c331fedb921582b922438b 1 parent fdd81ec
@cblanc cblanc authored
View
11 app/views/pages/documentation.jade
@@ -281,10 +281,19 @@ block content
h3#Random-Postcode Random Postcode
- p Returns a random postcode and all available data for that postcode
+ p Returns a random postcode and all available data for that postcode.
pre
h4
.http-method GET
| http://api.postcodes.io/random/postcodes
+ h3#Show-Outcode Outward Code Lookup
+
+ p Geolocation data for the centroid of the outward code specified. The outward code represents the first half of any postcode (separated by a space).
+
+ pre
+ h4
+ .http-method GET
+ | http://api.postcodes.io/outcodes/:outcode
+
View
9 app/views/pages/home.jade
@@ -129,3 +129,12 @@ block content
a(href="#")#query-postcode Request
pre.code-box#query-postcode-result
+ .api-method
+ h4.method-title Lookup Outward Code
+ h4
+ .http-method GET
+ | api.postcodes.io/outcodes/
+ input.rest-resource(value=":outcode")#show-outcode-input
+ a(href="#")#show-outcode Request
+ pre.code-box#show-outcode-result
+
View
9 public/js/app.js
@@ -124,4 +124,13 @@ $(function () {
$bulkGeocodeInput.addClass("invalid");
}
});
+
+ $("#show-outcode").click(function (event) {
+ event.preventDefault();
+ var $result = $("#show-outcode-result").slideUp(),
+ outcode = $("#show-outcode-input").val();
+ $.get(encodeURI("/outcodes/" + outcode), function (data) {
+ $result.html(JSON.stringify(data, null, 4)).slideDown();
+ });
+ });
});
Please sign in to comment.
Something went wrong with that request. Please try again.