client.resolve_address
Resolve Address
Returns the complete address for an autocomplete suggestion, identified by its address ID.
This is the step of the autocomplete flow that costs a lookup. Fetching suggestions is free.
The API returns resolved addresses, including addresses outside the UK, in a UK format (up to 3 address lines) using UK nomenclature such as postcode and county.
An ID that matches no address returns 404.
Endpoint
GET /autocomplete/addresses/{address}/gbr
See the API reference for this endpoint.
Signature
def resolve_address(address, tags: nil, remove_organisation: nil)
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
address | String | yes | ID of address suggestion |
keywords | keyword arguments | no | One 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.
| Name | Type | Required | Description |
|---|---|---|---|
tags | String, Array<String> | no | Tags |
remove_organisation | String | no | Remove Organisation |
Response
IdealPostcodes::Responses::GbrResolveAddressResponse. 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 IdealPostcodes::ApiError with the HTTP status, the API error code and the decoded body. A transport failure raises IdealPostcodes::TransportError. See error handling.
Example
require "ideal_postcodes"
client = IdealPostcodes::Client.new(api_key: "ak_test")
response = client.resolve_address("paf_2670849")
address = response.result
puts address.line_1
puts "#{address.post_town}, #{address.postcode}"
puts "UPRN #{address.uprn} from #{address.dataset}"