A HTTP mock server that responds like the real Firstclasspostcodes API. It is intended for use by clients integrating with our API, in order to improve integration testing and to ensure tests are less brittle.
To get started using the API, read the docs.
We provide clients in Ruby, PHP, Javascript/NodeJS, Python. To configure the client libraries to connect to this mock API, view the relevant library documentation.
A docker container is provided for ease of use:
docker run -p 80:2345 firstclasspostcodes/mock:v4.0.5.Now start calling the Firstclasspostcodes API:
curl -H 'X-Api-Key:111111111111' http://localhost:2345/postcode?search=AR514UI
The API Key is always 111111111111. If an API Key is not provided, 403 response is returned.
A small set of test data is available for querying through the mock API. A special endpoint is provided GET: /data/.postcodes which will list all postcodes currently provided for testing purposes.
Whilst the test data is sourced from our live API, it may not be in sync with updates.
Note: Additional postcodes will be added in major releases.
This is a node project, so first run npm i to fetch all the project dependencies. You'll also need a local version of the OpenAPI specification file to work with:
curl -o spec.json https://api.firstclasspostcodes.com/data/.spec
Running npm start will boot up the server.