|
1 | 1 | ## Postcode to address API |
2 | | -This is a web API that fetches data from [openaddresses](https://openaddresses.io/) provide postcode verification. |
| 2 | +This is a web API that fetches data from [openaddresses](https://openaddresses.io/) and provides postcode verification. |
| 3 | +It can be useful to verify user input, or pre-fill information (for example, the delivery address in a shopping cart). |
3 | 4 |
|
4 | 5 | Currently the data is only available for the Netherlands but the API could be extended to support multiple of the countries available on [openaddresses](https://openaddresses.io/). |
5 | 6 |
|
6 | 7 | ##### Example requests |
7 | 8 | `GET /addresses?postcode=1011PN` |
8 | 9 | `GET /addresses?postcode=1011PN&number=1` |
9 | 10 |
|
| 11 | +If the postcode is valid, you will get back the list of addresses associated to it. |
| 12 | +```json |
| 13 | +[ |
| 14 | + { |
| 15 | + "id":"5573a555-2ba2-4247-bf76-c2977d47fe8e", |
| 16 | + "lat":52.367645263671875, |
| 17 | + "lon":4.900165557861328, |
| 18 | + "number":"1", |
| 19 | + "street":"Amstel", |
| 20 | + "city":"Amsterdam", |
| 21 | + "region":"Noord-Holland", |
| 22 | + "postcode":"1011PN" |
| 23 | + } |
| 24 | + ] |
| 25 | +``` |
| 26 | + |
10 | 27 | ##### Query parameters |
11 | | -- `postcode` must be a valid postcode (check https://en.wikipedia.org/wiki/Postal_codes_in_the_Netherlands) |
| 28 | +- `postcode` must be a valid postcode (check https://en.wikipedia.org/wiki/Postal_codes_in_the_Netherlands). |
12 | 29 | - `number` is optional. When not specified, all the addresses associated with the postcode will be returned. |
13 | 30 |
|
14 | 31 | ### Technologies |
15 | 32 | - [Actix web 2.0](https://github.com/actix/actix-web) |
16 | 33 | - [Diesel](https://github.com/diesel-rs/diesel) |
17 | 34 | - [Postgres](https://www.postgresql.org/) |
18 | 35 |
|
19 | | -You can run the service by using Docker, or locally (with Rust >= 1.40 and a Postgres instance) |
| 36 | +You can run the service by using Docker, or locally (with Rust >= 1.40 and a Postgres instance). |
| 37 | +The first start will take a couple of minutes, as the service needs to fetch millions of address records. |
0 commit comments