Validate Locality
Endpoint for checking if an locality in a specific country is valid or not.
Endpoint URL
(GET) https://app-api.geposit.se/v2.0/validate/locality/{COUNTRY_CODE}
where {COUNTRY_CODE} is replaced with one of the following supported country codes:
- se (Sweden)
- no (Norway)
- dk (Denmark)
- fi (Finland)
Supported parameters
Query parameter | Value |
---|---|
api_key | Required A valid API key |
locality | Required The locality to validate. Example: locality=Stockholm |
response_format | Sets the format for the API response. The following values are supported: * xml * json(Default value) |
Response
Key | Value type | Value description |
---|---|---|
version | String | The API version |
response | Object | The main response object holding all data regarding the validated locality |
response_time | Float | The time it took for the service to process this request |
query | Object | Object containing the request parameters detected/used for locality input - declared as a query object (referenced below) |
interpretation | Object | Object containing the parsed version of the incoming locality - declared as a interpretation object (referenced below) |
is_valid | Integer | States if the sent in locality is valid or not. Possible values are: * false (Not valid) * true (Valid) |
match | Array | If the locality is correct - this array will contain an object with detailed description of the matched locality - declared as an match object (referenced below) |
Query object
Key | Value type | Value description |
---|---|---|
locality | String | The locality sent for validation formatted as in the request input parameter |
Interpretation object
Key | Value type | Value description |
---|---|---|
locality | String | Parsed locality / city |
Match object
Key | Value type | Value description |
---|---|---|
locality | String | Locality / city |
Error object
A key/value based object holding all the errors that were found with the incoming locality. Each key represent an error code and the value for that key gives you a textual representation of that error.
Possible error codes
Code | Explanation |
---|---|
300 | Locality is missing |
301 | Unknown format for the locality |
302 | Incorrect locality |
Examples
Example - Validation of a correct Swedish locality
Request
curl https://app-api.geposit.se/v2.0/validate/locality/se -d "locality=Stockholm&response_format=json&api_key={API_KEY}"
Response
{
"version": "2.0",
"response_time": 0.159,
"query": {
"locality": "Stockholm"
},
"interpretation": {
"locality": "Stockholm"
},
"is_valid": true,
"match": {
"locality": "Stockholm"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<api>
<version>2.0</version>
<response_time>0.203</response_time>
<query>
<locality>Stockholm</locality>
</query>
<interpretation>
<locality>Stockholm</locality>
</interpretation>
<is_valid>1</is_valid>
<match>
<locality>Stockholm</locality>
</match>
</api>
Example - Validation of an invalid Swedish locality
Request
curl https://app-api.geposit.se/v2.0/validate/locality/se -d "locality=Stickholm&response_format=json&api_key={API_KEY}"
Response
{
"version": "2.0",
"response_time": 0.092,
"query": {
"locality": "Stickholm"
},
"interpretation": {
"locality": "Stickholm"
},
"is_valid": false,
"errors": {
"402": "Felaktig postort"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<api>
<version>2.0</version>
<response_time>0.182</response_time>
<query>
<locality>Stickholm</locality>
</query>
<interpretation>
<locality>Stickholm</locality>
</interpretation>
<is_valid>0</is_valid>
<errors>
<error>
<error_code>402</error_code>
<error_text>Felaktig postort</error_text>
</error>
</errors>
</api>
Updated 6 months ago