Details

Get details of an autocomplete suggestion

  1. Introduction
  2. Required Parameters
  3. Optional Parameters
  4. Address Details example
  5. Responses
  6. Usage limits

Introduction

Woosmap Address Details endpoint provides details of an autocomplete suggestion (using the suggestion public_id).

Required Parameters

Certain parameters are required to initiate a Details request. As is standard in URLs, all parameters are separated using the ampersand(&) character. Few parameters are mandatory like the public_id which must be present in addition to a Woosmap API key.

        https://api.woosmap.com/address/details/json?public_id=aGVyZTpjbTpuYW1lZHBsYWNlOjIwMDA1MTI2&key={PUBLIC_API_KEY}

    

public_id

The identifier of the autocomplete suggestion. (public_id can be retrieved in the autocomplete response)

key

Your project’s API key. This key identifies your Woosmap Project for purposes of security and quota management. Public keys are designed to be used client side, where every request contain a referer.

Reminder: To use the Address API, your Public API key (parameter key) has to be authorized for the domains and/or IPs (referer) where you make the call. More on securing API keys here.

private_key

Your project’s private API key. This key identifies your Woosmap Project for purposes of security and quota management. Private keys are designed to be used server side, no referer checking associated with those keys.

Optional Parameters

language

The language to return the address elements in. Must be a ISO 639-1 language code.

fields

You can use this parameter to limit the returning fields (by default, all fields are return).

Available fields are (geometry) (fields should be separated by a ,). By using this parameter you will limit content of responses to the geometry part. No address component provided.

cc_format

To specify the format for the short country code expected to be returned in the address_components field (default is alpha3).

Available cc_format values are alpha2 or alpha3.

Address Details example

The following example requests the details of an address by specifying the required public_id:

Address Details call
        https://api.woosmap.com/address/details/json
  ?public_id=aGVyZTpjbTpuYW1lZHBsYWNlOjIwMzM3NDU0
  &key=YOUR_PUBLIC_API_KEY
    
        curl -L -X GET 'https://api.woosmap.com/address/details/json?public_id=aGVyZTpjbTpuYW1lZHBsYWNlOjIwMzM3NDU0&key=YOUR_PUBLIC_API_KEY' \
-H 'Referer: http://localhost'

    
        var requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.woosmap.com/address/details/json?public_id=aGVyZTpjbTpuYW1lZHBsYWNlOjIwMzM3NDU0&key=YOUR_PUBLIC_API_KEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

    
        var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://api.woosmap.com/address/details/json?public_id=aGVyZTpjbTpuYW1lZHBsYWNlOjIwMzM3NDU0&key=YOUR_PUBLIC_API_KEY',
  headers: { 
    'Referer': 'http://localhost'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});


    
        import requests

url = "https://api.woosmap.com/address/details/json?public_id=aGVyZTpjbTpuYW1lZHBsYWNlOjIwMzM3NDU0&key=YOUR_PUBLIC_API_KEY"

payload={}
headers = {
    'Referer': 'http://localhost'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)


    
        OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api.woosmap.com/address/details/json?public_id=aGVyZTpjbTpuYW1lZHBsYWNlOjIwMzM3NDU0&key=YOUR_PUBLIC_API_KEY")
  .method("GET", body)
  .addHeader("Referer", "http://localhost")
  .build();
Response response = client.newCall(request).execute();

    
        require "uri"
require "net/http"

url = URI("https://api.woosmap.com/address/details/json?public_id=aGVyZTpjbTpuYW1lZHBsYWNlOjIwMzM3NDU0&key=YOUR_PUBLIC_API_KEY")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Referer"] = "http://localhost"

response = https.request(request)
puts response.read_body


    

Responses

Address Details API endpoint provides a JSON response containing one root element, result which contains the serialized address result.

Address Details Response
JSON
        {
  "result":
    {
      "formatted_address": "London, England, United Kingdom",
      "types": ["locality"],
      "public_id": "aGVyZTpjbTpuYW1lZHBsYWNlOjIwMzM3NDU0",
      "address_components":
        [
          {
            "types": ["country"],
            "long_name": "United Kingdom",
            "short_name": "GBR",
          },
          {
            "types": ["state"],
            "long_name": "England",
            "short_name": "England",
          },
          { "types": ["county"], "long_name": "London", "short_name": "LDN" },
          {
            "long_name": "London",
            "short_name": "London",
            "types": ["locality"],
          },
          {
            "long_name": "SW1A 2",
            "short_name": "SW1A 2",
            "types": ["postal_code"],
          },
        ],
      "geometry":
        {
          "location_type": "GEOMETRIC_CENTER",
          "location": { "lat": 51.50643, "lng": -0.12719 },
          "viewport":
            {
              "northeast": { "lat": 51.68629, "lng": 0.28206 },
              "southwest": { "lat": 51.28043, "lng": -0.56316 },
            },
        },
    },
  "status": "OK",
}

    

Result

A result contains the following fields:

formatted_address

Contains the text description of the proposal to be used as prediction in drop down list if needed.

type

Contains the type of result. Can be any value from following list:
house_number route address_block locality admin_level country

public_id

The public_id of the result (return by autocomplete endpoint)

address_components

Description of all the components of the address (long and short). Those fields are provided when no fields parameter is set in the request.

geometry

The geometry and the viewport of the result.

status

Returns more info on if the request was successful or not, valid responses:

OK indicates the response contains a valid result.
INVALID_REQUEST indicates that the provided request was invalid (e.g. wrong URL syntax).
REQUEST_DENIED indicates that the service denied use of the Address API (e.g. wrong API Key, wrong/no referer, …).
UNKNOWN_ERROR indicates an Address API request could not be processed due to a server error. The request may succeed if you try again.

Usage limits

The following usage limits are in place for the Address API on the /details endpoint:

Was this article helpful?
Have more questions? Submit a request