Options
All
  • Public
  • Public/Protected
  • All
Menu

Ideal Postcodes API Fixtures

Static test fixtures generated from api.ideal-postcodes.co.uk

CircleCI Coverage Status Try on RunKit npm version

This library provides static HTTP API response data for api.ideal-postcodes.co.uk as JSON objects. Canned API responses are exported as Fixture objects, containing a JSON response body (body) and HTTP Status Code (httpStatus).

Fixtures are periodically regenerated with live API requests from api.ideal-postcodes.co.uk.

We use it internally as an initial line of testing to mock HTTP requests and stub out API client function calls.

Features

  • Static, importable JSON response payloads generated from api.ideal-postcodes.co.uk (ideal for mock HTTP requests or stubbing API clients)
  • HTTP request definition included
  • Periodically regenerated from live API responses
  • Typescript typings
  • Detailed, low level fixture and type documentation

Usage

Example

npm install @ideal-postcodes/api-fixtures
import { postcodes } from "@ideal-postcodes/api-fixtures";

// or 
// const { postcodes } = require("@ideal-postcodes/api-fixtures");

console.log(postcodes.success);

{
  url: "/v1/postcodes/SW1A2AA",
  httpStatus: 200,
  body: {
    "code": 2000,
    "message": "success",
    "results": [
      {
        "postcode": "SW1A 2AA",
        "postcode_inward": "2AA",
        "postcode_outward": "SW1A",
        "post_town": "LONDON",
        "dependant_locality": "",
        "double_dependant_locality": "",
        "thoroughfare": "Downing Street",
        "dependant_thoroughfare": "",
        "building_number": "10",
        "building_name": "",
        "department_name": "",
        "organisation_name": "Prime Minister & First Lord Of The Treasury",
        "udprn": 23747771,
        "umprn": "",
        "delivery_point_suffix": "1A",
        "line_1": "Prime Minister & First Lord Of The Treasury",
        "line_2": "10 Downing Street",
        "line_3": "",
        "premise": "10",
        //...etc

Quick Reference

License

Code is MIT

Data provided by API is for testing and integration purposes only for PAF Products

Index

Object literals

Const addresses

addresses: object

API responses returned by the /addresses API

empty

empty: object = ad_empty

Address query returned no results

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • hits: never[]
      • limit: number
      • page: number
      • total: number
  • query: object
    • api_key: string
    • query: string

success

success: object = ad_success

Successful address query response

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • hits: object[]
      • limit: number
      • page: number
      • total: number
  • query: object
    • api_key: string
    • query: string

multipleResidence

multipleResidence: object

Multiple Residence API responses

success

success: object = ad_mrSuccess

Successful Multiple Residence address query

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • hits: object[]
      • limit: number
      • page: number
      • total: number
  • query: object
    • api_key: string
    • query: string

Const autocomplete

autocomplete: object

API responses returned by the /autocomplete API

empty

empty: object = au_empty

Autocomplet request with no suggestions

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • hits: never[]
  • query: object
    • api_key: string
    • q: string

success

success: object = au_success

Successful autocomplete request

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • hits: object[]
  • query: object
    • api_key: string
    • query: string

multipleResidence

multipleResidence: object

Multiple Residence API responses

success

success: object = au_mrSuccess

Successful Multiple Residence autocomplete query

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • hits: object[]
  • query: object
    • api_key: string
    • query: string

Const errors

errors: object

Errors responses returned by API

balanceDepleted

balanceDepleted: object = er_balanceDepleted

API Key balance depleted response

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
  • query: object
    • api_key: string

dailyIpRateLimitReached

dailyIpRateLimitReached: object = er_limitReached

Maximum number of lookups performed on key for requesting IP address

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
  • query: object
    • api_key: string

dailyLimitReached

dailyLimitReached: object = er_limitReached

Maximum number of lookups performed on key today

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
  • query: object
    • api_key: string

invalidKey

invalidKey: object = er_invalidKey

Invalid API Key response

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
  • query: object
    • api_key: string

invalidUrl

invalidUrl: object = er_invalidUrl

Invalid requesting URL response

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
  • query: object
    • api_key: string

Const keys

keys: object

API responses returned by the /keys API

check

check: object

API Key requests for public consumption (i.e. no user_token is presented)

available

available: object = ke_available

Key available response

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • query: object
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • available: boolean

invalid

invalid: object = ke_invalid

Invalid key requested

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • query: object
  • url: string
  • body: object
    • code: number
    • message: string

unavailable

unavailable: object = ke_unavailable

Key unavailable response

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • query: object
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • available: boolean

private

private: object

API Key requests for private consumption (i.e. user_token is presented)

success

success: object = ke_private_success

Private key details successfully extracted

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • allowed_urls: never[]
      • current_purchases: never[]
      • lookups_remaining: number
      • automated_topups: object
        • enabled: boolean
      • daily_limit: object
        • consumed: number
        • limit: null
      • individual_limit: object
        • ipForwarding: boolean
        • limit: null
      • notifications: object
        • emails: string[]
        • enabled: boolean
  • query: object
    • user_token: string

usage

usage: object

Private key usage successfully extracted

success

success: object = ke_usage_success

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • dailyCount: object[]
      • end: string
      • start: string
      • total: number
  • query: object
    • user_token: string

Const postcodes

postcodes: object

API responses returned by the /postcodes API

notFound

notFound: object = pc_notFound

Requested postcode does not exist

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
  • query: object
    • api_key: string

success

success: object = pc_success

Successful postcode request

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object[]
  • query: object
    • api_key: string

multipleResidence

multipleResidence: object

Multiple Residence API Responses

success

success: object = pc_mrSuccess

Successful Multiple Residence postcode query

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • limit: number
    • message: string
    • page: number
    • result: (object | object)[]
    • total: number
  • query: object
    • api_key: string

Const udprn

udprn: object

API responses returned by the /udprn API

notFound

notFound: object = ud_notFound

Requested UDPRN not found

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
  • query: object
    • api_key: string

success

success: object = ud_success

Successful UDPRN request

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • administrative_county: string
      • building_name: string
      • building_number: string
      • country: string
      • county: string
      • delivery_point_suffix: string
      • department_name: string
      • dependant_locality: string
      • dependant_thoroughfare: string
      • district: string
      • double_dependant_locality: string
      • eastings: number
      • latitude: number
      • line_1: string
      • line_2: string
      • line_3: string
      • longitude: number
      • northings: number
      • organisation_name: string
      • po_box: string
      • post_town: string
      • postal_county: string
      • postcode: string
      • postcode_inward: string
      • postcode_outward: string
      • postcode_type: string
      • premise: string
      • su_organisation_indicator: string
      • sub_building_name: string
      • thoroughfare: string
      • traditional_county: string
      • udprn: number
      • umprn: string
      • ward: string
  • query: object
    • api_key: string

Const umprn

umprn: object

API responses returned by the /umprn API

notFound

notFound: object = um_notFound

Requested UMPRN not found

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
  • query: object
    • api_key: string

success

success: object = um_success

Successful UMPRN request

Type declaration

  • description: string
  • headers: object
  • httpStatus: number
  • url: string
  • body: object
    • code: number
    • message: string
    • result: object
      • administrative_county: string
      • building_name: string
      • building_number: string
      • country: string
      • county: string
      • delivery_point_suffix: string
      • department_name: string
      • dependant_locality: string
      • dependant_thoroughfare: string
      • district: string
      • double_dependant_locality: string
      • eastings: number
      • latitude: number
      • line_1: string
      • line_2: string
      • line_3: string
      • longitude: number
      • northings: number
      • organisation_name: string
      • po_box: string
      • post_town: string
      • postal_county: string
      • postcode: string
      • postcode_inward: string
      • postcode_outward: string
      • postcode_type: string
      • premise: string
      • su_organisation_indicator: string
      • sub_building_name: string
      • thoroughfare: string
      • traditional_county: string
      • udprn: number
      • umprn: number
      • ward: string
  • query: object
    • api_key: string