Postcode
Performs a Find Your Nearest search based on:
- A full UK Postcode
- A 5-digit USA Zip Code
- A full Canadian Postcode
Please note that this endpoint only supports the UK, USA, and Canada.
URL: /fyn/v1/postcode
Method: POST
Method Parameters
Name |
Type |
Required |
Description |
|
|
|
|
|
|
|
See Model Object Properties. |
Model Object Properties
Name |
Type |
Required |
Description |
|
|
|
|
|
|
|
|
|
|
|
Where no value is provided, the default value of GB is used. |
Response
Code |
Error Message |
Notes |
|
|
Note: It is possible to get a result from an Allocation rule with an invalid postcode, providing that part of the postcode was matched against a territory. If further results were requested and the postcode was invalid, you will get a successful response. |
|
|
|
400 |
|
|
400 |
|
|
400 |
|
|
400 |
The Postcode provided was not in the format of a full UK postcode. |
Expected formats: A0 0AA, A00 0AA, AA0 0AA, AA00 0AA, A0A 0AA, where A is a letter, and 0 is a number. |
400 |
The ZIP code provided was not in the format of a ZIP code. |
Expected formats: 00000 or 00000-0000. Note that the +4 is ignored. |
400 |
The Postcode provided was not in the format of a full Canadian postcode. |
Expected formats: A0A 0A0, where A is a letter, and 0 is a number. |
400 |
|
|
400 |
|
|
404 |
|
|
404 |
|
|
Example call
URL: https://api.vision-mapping.com/fyn/v1/postcode?apiKey=INSERT_YOUR_KEY_HERE
Body:
{
rulesetKey: "abc",
postcode: "abc",
region: "abc"
}
Example response
[
{
name: "abc",
uniqueKey: "abc",
distanceInMiles: 123,
dataFields: [
{
key: "abc",
value: string | number | boolean | object
}
],
matchedTags: [
"abc",
"abc"
]
}
]
If receiving an object, the structure is as follows:
{
lines: [""],
city: "",
county: "",
postcode: "",
country: ""
}
Result Order
When more than one result is requested, the default order of results is by distance (nearest first, farthest last).
When tagKeys are provided, the order is changed to:
- The number of tags matched
- The distance
Note: This means that if three tagKeys were provided, any results matching all three would be placed first, ordered within themselves by distance, then any results matching two keys ordered by distance and so on. The first result, therefore, is not the closest, but the closest which matches the most tags.