AutoComplete
Please read API Overview first
API Endpoint
The Autocomplete API endpoint won't change. It can be set as a constant.
https://api.autoaddress.ie/2.0/autocomplete
N.B. This EndPoint URL resolves to a dynamic IP address, please be aware of this when making DNS and Firewall decisions.
Request
To search for a Postcode or Address, a simple GET
request from your desired language is all that is needed.
- cURL
curl -v "https://api.autoaddress.ie/2.0/autocomplete?key=YOUR_KEY &address=YOUR_ADDRESS_OR_POSTCODE&addressProfileName=Demo5LineV2&vanityMode=true"<br>
- jQuery
$.ajax({ type: "GET", dataType: "jsonp", url: "https://api.autoaddress.ie/2.0/autocomplete", data : { key: "YOUR_KEY", address: "YOUR_ADDRESS_OR_POSTCODE", addressProfileName: "Demo5LineV2", vanityMode: true }, success: function(data){ //do something with data } });
- Angular JS
$http.jsonp('https://api.autoaddress.ie/2.0/autocomplete',{ params: { key: "YOUR_KEY", address: "YOUR_ADDRESS_OR_POSTCODE", addressProfileName: "Demo5LineV2", vanityMode: true } }).success(function(data){ //do something with data });
- Ruby
require 'json' require 'net/http' uri = URI.parse("https://api.autoaddress.ie/2.0/autocomplete?key=YOUR_KEY&address=YOUR_ADDRESS_OR_POSTCODE&addressProfileName=Demo5LineV2&vanityMode=true") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE response = http.get(uri.request_uri) result = JSON.parse(response.body)
- Python
import json import urllib2 Response = urllib2.urlopen ("https://api.autoaddress.ie/2.0/autocomplete?key=YOUR_KEY&address=YOUR_ADDRESS_OR_POSTCODE&addressProfileName=Demo5LineV2&vanityMode=true") jsonResult = json.load(Response)
- C#
using System.IO; using System.Net; HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.autoaddress.ie/2.0/autocomplete?key=YOUR_KEY&address=YOUR_ADDRESS_OR_POSTCODE&addressProfileName=Demo5LineV2&vanityMode=true"); request.Method = WebRequestMethods.Http.Get; request.Accept = "application/json"; using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { var result = new StreamReader(response.GetResponseStream()).ReadToEnd(); }
Response
The Autocomplete API call response may contain Options. The Options consist of an array of addresses that match the input characters, together with a HATEOAS link. This allows interaction with the API solely through the hyperlinks we provide you. As a developer you display the DisplayName to the user as a list. When the user selects an Option, retrieve the next href from that Option object and perform a GET request on that url which will make a call to the FindAddress API.
The following is a sample JSON response returned for a Autocomplete API request.
{ "totalOptions": 1, "options": [ { "displayName": "4 INNS COURT, WINETAVERN STREET, DUBLIN 8", "addressId": 1702105351, "addressType": { "code": 2100, "text": "NonResidentialAddressPoint" }, "links": [ { "rel": "next", "href": "https://api.autoaddress.ie/2.0/findaddress?key=YOUR_KEY&txn=4c43fa7d-6871-45f6-80cf-62f5034247cb&address=4%20INNS%20COURT%2C%20WINETAVERN%20STREET%2C%20DUBLIN%208&addressId=1702105351&limit=-1&vanityMode=True&addressElements=False&addressProfileName=Demo5LineV2" } ] } ], "input": { "key": "YOUR_KEY", "txn": "4c43fa7d-6871-45f6-80cf-62f5034247cb", "language": "en", "country": "ie", "limit": -1, "address": "4 inns co", "vanityMode": true, "addressElements": false, "addressProfileName: "Demo5LineV2" }, "links": [ { "rel": "self", "href": "https://api.autoaddress.ie/2.0/autocomplete?key=YOUR_KEY&address=4+inns+co&language=en&vanityMode=True&addressElements=false&addressProfileName=Demo5LineV2" } ] }
Input Fields
Name | Type | Default | Description |
---|---|---|---|
key* | string | None | Licence key IMPORTANT: The key parameter name must be all lower case. |
address* | string | None | Address or Postcode to Search |
limit | integer | -1 | If supplied and an option link is followed, this value is used to construct the FindAddress Url for the options returned from AutoComplete and is set as the options limit for the FindAddress Url. |
language | string | "en" | Language for returned address. Allowed values are "en" for English and "ga" for Irish. |
country | string | "ie" | Country the address should be searched in. Allowed values are "ie" for Ireland, "ni" for Northern Ireland and "gb" for Great Britain. |
geographicAddress | boolean | false | Return geographic address. |
vanityMode | boolean | false | Return vanity address format, if it exists. |
addressElements | boolean | false | Return address elements when an option link is followed. |
addressProfileName | string | None | If supplied and an option link is followed, a reformatted address (according to profile rules) is returned in reformattedAddress field in JSON response. |
txn | string | None | Transaction ID from previous call in the session |
* Required Field
Output Fields
Name | Type | Description |
---|---|---|
totalOptions | int | Number of options found |
options | option [ ] | An array of Option objects (described below). |
input | object | Input Object with Request Input Fields. |
links | link [ ] | An array of Link objects (described below). |
Option Object
Name | Type | Description |
---|---|---|
optionType | enum | Option Type Details
|
displayName | string | Option Name |
addressId | integer | Address ID (i.e. ECAD ID for Ireland) |
addressType | enum | Type of Address Found Full list of Address Types |
links | link [ ] | An array of Link objects (described below). |
Link Object
Name | Type | Description |
---|---|---|
rel | string | API response usually includes an array of HATEOAS links. This allows interaction with the API solely through the hyperlinks we provide you. You no longer need to hardcode logic into your client in order to use our API. |
href | string | The hyperlink the client should follow is stored in the value of “href” property. That value can have some internal parameters, so the client should not parse it or modify it in any way. |