Skip to content

A simple API wrapper for the Postcode Anywhere (PCA Predict) Service

Notifications You must be signed in to change notification settings

thesold/pcapredict

Repository files navigation

Loqate (Postcode Anywhere / PCA Predict) API Wrapper

A simple API wrapper for the Loqate (Postcode Anywhere / PCA Predict) Service

Authors:

Overview

An unofficial implementation of the Loqate API for modern Javascript to easily lookup addresses from Post Codes or Partial Address details.

Requirements

A Loqate account and API key is required to use this package.

Installation

Add the package to your project

npm install @thesold/pcapredict

Usage

import { Lookup } from '@thesold/pcapredict'

const lookup = new Lookup('API-KEY')

lookup.find('POST CODE').get()
    .then((results) =>
        // results contains an array of addresses found
        lookup.retrieve(results[0]).then((address) => {
            // address contains the full address details for the requested entry
        })
    )
    .catch((error) => {
        // Something went wrong
    })

Please see the official API documentation for details about the data returned.