Toggle menu

postcodeSearch (postcode, provider)

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

NameTypeDescription
postcodeString, requiredThe postcode to search for
providerString, optionalThe 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 address data in this format. This is the format expected by the Address Lookup form field type.

Should your provider return data in a different format, there are some simple changes you can make to the address lookup field. See the Postcode Lookups reference article for more information.

{
    "id": 231,
    "result": [{
        "udprn": "18994215",
        "company": "Goss Interactive Ltd",
        "department": "",
        "line1": "24 Darklake View",
        "line2": "Estover",
        "line3": "",
        "line4": "",
        "line5": "",
        "town": "Plymouth",
        "county": "Devon",
        "postcode": "PL6 7TL"
    }],
    "jsonrpc": "2.0"
}

Last modified on 31 July 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon