New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

postcodes

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcodes

Postcode lookup API for UK addresses from Open Postcodes, more information at https://openpostcodes.com

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

Open Postcodes Node.js API Wrapper

Retrieve a list of addresses for any postcode in the United Kingdom using the Open Postcodes API.

Getting Started

You can complete a full address lookup with just a couple of lines of code. Install and insert your API key, you can start immediately performing UK postcode address lookups.

Installation

Install using the node package manager, npm.

npm install postcodes

Remember to include it in package.json for portability purposes.

Get an API Key

Get a key at Open Postcodes, then try out our service with our testing postcodes e.g. 'XA1 0XX'

Configuration

You must include your API key when requiring the postcodes module. This will return an instance allowing you to perform your postcode lookups on the Open Postcodes API.

var api_key = "your api key"
var Postcodes = require('postcodes')(api_key)

Usage

Perform lookups by calling #lookupPostode(postcode, callback). This function is asynchronous and so takes 2 arguments, the postcode and a callback to handle the response.

You can use the postcode "XA1 0XX" to test our service.

Postcodes.lookupPostcode("XA1 0XX", function (error, addresses) {
	if (error) throw error; // Add error handling
	console.log(addresses);
});

// => Will output an array of addresses
//	[ {
//			postcode: 'XA1 0XX',
//			post_town: 'LONDON',
//			line_1: 'The Pavilion',
//			line_2: 'Oaks Avenue',
//			line_3: '', 
//			organisation_name: '',
//			building_name: 'The Pavilion',
// 			...truncated...
//		}, ...

Signing Up

Open Postcodes provides street level address data for website, mobile and desktop applications at a competitive price.

We charge 1p per public lookup; take a look at our pricing

Documentation

More in-depth documentation can be found here

License

Public Domain

Keywords

UK

FAQs

Package last updated on 24 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts