Searches for addresses that match a supplied postcode. Return an array of matching addresses. If there are no matching addresses the array will be empty.
The default postcode provider will be used if one is not included with your request.
Parameters
Name | Type | Description |
---|---|---|
postcode | String, required | The postcode to search for |
provider | String, optional | The name of the postcode provider to use |
Example Request
This request uses the example provider, which only returns results for PL6 7TL.
function(params, credentials) {
let resp = this.callWorkerMethod("postcode", "postcodeSearch", {
"postcode": "PL6 7TL"
});
return resp;
}
Returns
The example provider returns an array of address objects in the following format, which is the format expected by the Address Lookup form field.
{
"udprn": "10070767046",
"company": "",
"department": "",
"line1": "24 DARKLAKE VIEW",
"line2": "",
"line3": "",
"line4": "",
"line5": "",
"town": "PLYMOUTH",
"county": "",
"postcode": "PL6 7TL",
"ward": "E05002086",
"location": "",
"easting": 251483.984375,
"northing": 60263.73046875,
"latitude": 50.42340377068654,
"longitude": -4.092103889615438,
"custodian": 1160
}