Try It!

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 parameterValue
api_keyRequired
A valid API key
localityRequired
The locality to validate.
Example: locality=Stockholm
response_formatSets the format for the API response.
The following values are supported:
* xml
* json(Default value)

Response

KeyValue typeValue description
versionStringThe API version
responseObjectThe main response object holding all data regarding the validated locality
response_timeFloatThe time it took for the service to process this request
queryObjectObject containing the request parameters detected/used for locality input - declared as a query object (referenced below)
interpretationObjectObject containing the parsed version of the incoming locality - declared as a interpretation object (referenced below)
is_validIntegerStates if the sent in locality is valid or not. Possible values are:
* false (Not valid)
* true (Valid)
matchArrayIf 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

KeyValue typeValue description
localityStringThe locality sent for validation formatted as in the request input parameter

Interpretation object

KeyValue typeValue description
localityStringParsed locality / city

Match object

KeyValue typeValue description
localityStringLocality / 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

CodeExplanation
300Locality is missing
301Unknown format for the locality
302Incorrect 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>