Skip to main content

client.resolve_place

Resolve Place

Returns the full place for a place ID taken from a /places suggestion.

On top of the fields carried by the suggestion, the response adds coordinates, language and the underlying dataset record.

Each request decrements your lookup balance. An unknown ID returns 404.

Endpoint​

GET /places/{place}

See the API reference for this endpoint.

Signature​

def resolve_place(place, tags: nil)

Arguments​

NameTypeRequiredDescription
placeStringyesID of place suggestion
keywordskeyword argumentsnoOne per query parameter, named as the API names them. A keyword left out or nil is not sent.

Query Parameters​

Pass these as keyword arguments.

NameTypeRequiredDescription
tagsString, Array<String>noTags

Response​

AddressZen::Responses::ResolvePlaceResponse. Read fields with readers named as the API names them, such as response.result, or with response["result"]. to_h returns the decoded body.

Errors​

An HTTP error raises AddressZen::ApiError with the HTTP status, the API error code and the decoded body. A transport failure raises AddressZen::TransportError. See error handling.

Example​

resolve-place.rbruby
require "addresszen"

client = AddressZen::Client.new(api_key: "ak_test")

response = client.resolve_place("geonames_5128581")

place = response.result

puts "#{place.descriptive_name} (#{place.country_iso})"
puts "#{place.latitude}, #{place.longitude}"