/location

This page describes different actions that can be used to calculate distances between customer and restaurant and to convert coordinates to address and vice versa.

/location/distance_by_roads

This action can be used to calculate distance between restaurant and customer’s address.

Request

POST nameValueRequired?
restaurant_id774Yes
addressExample Address 1Yes
postal_code04250Yes*
cityDummycityYes*
latitude25.5203422Yes**
longitude53.3422342Yes**

(*) For postal_code and city, only one of them is required, but most accurate results can be gotten by passing the city, with or without postal code.

(**) You can insert latitude and longitude instead of an address. If both are given, latitude and longitude are preferred.

Response

Response is following string, or in case of error an error array.

"4.2"

The response is a double, wrapped as a JSON string, of kilometers of distance by roads between the given restaurant and given address.

Expectable errors

Label Additional data Description
INVALID_INPUTNoneIn case address was wrong or something like that.
INVALID_RESTAURANT_IDNoneIf the restaurant id passed was wrong. Fix your client.

/location/geocode

Converts an address to coordinates.

Request

POST nameValueRequired?
addressExample Address 1Yes
postal_code04250Yes*
cityDummycityYes*

(*) For postal_code and city, only one of them is required, but most accurate results can be gotten by passing the city, with or without postal code.

Response

{
  "latitude":"25.256252424",
  "longitude":"61.12987342897"
}

Expectable errors

Label Additional data Description
INVALID_INPUTNoneIn case address was wrong or something like that.

/location/reverse

Convert given coordinates to address.

Request

POST nameValueRequired?
latitude25.32532432Yes
longitude26.4322423Yes

Response

{
  "address":"Dummy Address 2",
  "city":"Nyancity",
  "postal_code":"04250"
}

address

Street address may not be present in the response in case you’re for example in some kind of large complex which does not have specific street address in the data. Generally it will always be present.

Expectable errors

Label Additional data Description
NO_RESULTSNoneIn case there was no results with given coordinates. Since we more or less only have Finnish data, this may be because coordinates are from outside Finland