Static test fixtures generated from api.ideal-postcodes.co.uk
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.
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
Code is MIT
Data provided by API is for testing and integration purposes only for PAF Products
Address query returned no results
Successful address query response
Multiple Residence API responses
Successful Multiple Residence address query
API responses returned by the /autocomplete
API
Autocomplet request with no suggestions
Successful autocomplete request
Multiple Residence API responses
Successful Multiple Residence autocomplete query
Errors responses returned by API
API Key balance depleted response
Maximum number of lookups performed on key for requesting IP address
Maximum number of lookups performed on key today
Invalid API Key response
Invalid requesting URL response
API responses returned by the /keys
API
API Key requests for public consumption (i.e. no user_token
is presented)
Key available response
Invalid key requested
Key unavailable response
API Key requests for private consumption (i.e. user_token
is presented)
Private key details successfully extracted
Private key usage successfully extracted
API responses returned by the /postcodes
API
Requested postcode does not exist
Successful postcode request
Multiple Residence API Responses
Successful Multiple Residence postcode query
API responses returned by the /udprn
API
Requested UDPRN not found
Successful UDPRN request
API responses returned by the /umprn
API
Requested UMPRN not found
Successful UMPRN request
API responses returned by the
/addresses
API