Check Address in Area
Check address in area¶
With this endpoint you can check if an address lies within an Atlas area.
URL¶
POST https://api.geposit.se/1.1/check/address/in/areas
Mandatory header parameters¶
x-api-key
(String) This is your API-key and should be included in the header.
Mandatory POST parameters¶
-
street
(String) This is the street name of the address to check. -
postalcode
(String) This is the postalcode of the address to check. -
locality
(String) This is the locality of the address to check. -
country_code
(String) The country code of the postalcode. The following country codes are supported:se
(Sweden)no
(Norway)dk
(Denmark)fi
(Finland)
This API end-point assumes that the address is a valid address and will only return limited error codes if it is incorrect. For help in validating the address before using this API, see our Valid API.
Optional POST parameters¶
-
street_number
(Integer) This is the street number of the address that you want to check. This is optional, since not all addresses have a street number. -
letter
(String) This is the letter of the address that you want to check. This is optional, since not all addresses have a letter. -
Attribute filtering/conditioning
(String) The following operands can be used to filter for specific values.
Operand | Description | Description |
---|---|---|
eq | is equal to | Exact match to a value |
ct | contains | Contains the value |
nc | doesn't contain | Does not contain the value |
in | is in one or more | Does contain exact match to numeric value |
ni | is not in one or more | Does not contain exact match to numeric value |
ne | is not equal to | Does not match exact value |
be | value BETWEEN low AND high | For time: time[be][]=10:00&time[be][]=12:00 For numeric value: value[be][]=100&value[be][]=1000 For date: date[be][]=2019-01-01&date[be][]=2019-10-10 |
lt | is less than | Numeric value is less than specified one |
gt | is greater than | Numeric value is greater than specified one |
Examples:
Check address against areas where revenue
greater than 150. Where revenue
is a custom_field.
curl -X POST -H "X-api-key: {API_KEY}" https://api.geposit.se/1.1/check/address/in/areas -d "country_code=se&street=Bergabovägen&street_number=1&postalcode=13337&locality=Saltsjöbaden&revenue[gt]=150"
Check address against areas where the regdate
is between 2020-01-01 and 2020-03-01. Where regdate
is a custom_field.
curl -X POST -H "X-api-key: {API_KEY}" https://api.geposit.se/1.1/check/address/in/areas -d "country_code=se&street=Bergabovägen&street_number=1&postalcode=13337&locality=Saltsjöbaden®date[be][]=2020-01-01®date[be][]=2020-03-01"
Example Request¶
curl -X POST -H "X-api-key: {API_KEY}" https://api.geposit.se/1.1/check/address/in/areas -d "country_code=se&street=Bergabovägen&street_number=1&postalcode=13337&locality=Saltsjöbaden"
client()->post("check/address/in/areas", [
"query" => [
"street" => "Bergabovägen",
"street_number" => "1",
"postalcode" => "13337",
"locality" => "Saltsjöbaden",
"country_code" => "se",
],
"headers" => [
"x-api-key" => "your-api-key"
],
]);
Response¶
The response will be in JSON format. Every response comes with a status flag (Integer) where:
status = 0
- Incoming address is invalid / generic error.status = 1
- Incoming address is valid and exists.
Valid response¶
-
areas
(Array) Array with zero or more area object(s) that contains the address in the request. An empty array indicates that the address is not part of any area. -
area_id
(Integer) The unique identifier of the area. This id can be used to fetch more detailed information about the area, using the get area details endpoint. -
name
(String) The name of the area.
{
"status": 1,
"areas": [
{
"area_id": "551",
"name": "The Area Name",
"my_own_attribute1":"my_own_attribute_value",
"my_own_attribute2":"my_own_attribute_value"
}
]
}
{
"status": 1,
"areas": []
}
Invalid responses¶
{
"status": 0,
"error": "Incorrect address"
}
{
"status": 0,
"error": "Invalid country code parameter"
}
{
"status": 0,
"error": "Generic error"
}