Skip to content

Lookup

The Lookup package provides classes to acquire and evaluate specific details and rich content associated with a single entity. The main features are executed within Get Entity Detail.

Please see the API reference for the main classes related to Lookup.

Get Entity Detail

This feature retrieves detailed information about an entity. The id is usually retrieved from a previous entity search results list. The entity details will be dependent on the entity type which are an address or POI. Generally, the entity details will be evaluated to determine entity detail results type and developer will build logic based on entity detail results type.

Key methods

Method Details
setEntityIds(List entityIds) The unique id list of the address or POI entity

Sample code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
String addressEntityId = "Yz1zYW50YSBjbGFyYTtjbz11cztzZm49Z3JlYXQgYW1lcmljYSBwa3d5O2g9NDY1NTt6PTk1MDU0O3M9Y2E7aWQ9MTA2NTI0MDYxO2x0PTM3LjM5ODE1O2xuPS0xMjEuOTc3ODk7cmdjPWZhbHNlOwV6";

entityClient.getDetailRequest()
    .setEntityIds(Arrays.asList(addressEntityId))
    .asyncCall(new Callback<EntityGetDetailResponse>() {

        @Override
        public void onSuccess(EntityGetDetailResponse response) {
            // log response in JSON format
            LOG.info(EntityJsonConverter.toPrettyJson(response));

            List<Entity> detailEntities = response.getResults();
            for (Entity entity : detailEntities) {
                if (entity.getType() == EntityType.PLACE) {
                    LOG.info("Found Place: " + entity.getPlace().getName());
                } else if (entity.getType() == EntityType.ADDRESS) {
                    LOG.info("Found Address: " + entity.getAddress().getFormattedAddress());
                }
            }
        }

        @Override
        public void onFailure(Throwable t) {
            LOG.error("Get unsuccessful response or throwable happened when executing the request.", t);
        }
    });
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
val addressEntityId = "Yz1zYW50YSBjbGFyYTtjbz11cztzZm49Z3JlYXQgYW1lcmljYSBwa3d5O2g9NDY1NTt6PTk1MDU0O3M9Y2E7aWQ9MTA2NTI0MDYxO2x0PTM3LjM5ODE1O2xuPS0xMjEuOTc3ODk7cmdjPWZhbHNlOwV6"

entityClient.getDetailRequest()
    .setEntityIds(listOf(addressEntityId))
    .asyncCall(object : Callback<EntityGetDetailResponse> {

        override fun onSuccess(response: EntityGetDetailResponse) {
            // log response in JSON format
            Log.i("sdk", EntityJsonConverter.toPrettyJson(response))

            val detailEntities = response.results
            for (entity in detailEntities) {
                if (entity.type == EntityType.PLACE) {
                    Log.i("sdk", "Found Place: ${entity.place.name}")
                } else if (entity.type == EntityType.ADDRESS) {
                    Log.i("sdk", "Found Address: ${entity.address.formattedAddress}")
                }
            }
        }

        override fun onFailure(t: Throwable) {
            Log.e("sdk", "Get unsuccessful response or throwable happened when executing the request.", t)
        }
    })

Response example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  "code": "SUCCESS",
  "message": "SUCCESS",
  "results": [
    {
      "id": "Yz1zYW50YSBjbGFyYTtjbz11cztzZm49Z3JlYXQgYW1lcmljYSBwa3d5O2g9NDY1NTt6PTk1MDU0O3M9Y2E7aWQ9MTA2NTI0MDYxO2x0PTM3LjM5ODE1O2xuPS0xMjEuOTc3ODk7cmdjPWZhbHNlOwV6",
      "type": "ADDRESS",
      "address": {
        "address_type": "STREET",
        "formatted_address": "4655 Great America Pkwy, Santa Clara CA 95054, USA",
        "house_number": "4655",
        "street": {
          "body": "great america",
          "type": "parkway",
          "formatted_name": "Great America Pkwy"
        },
        "city": "Santa Clara",
        "county": "Santa Clara",
        "state": "CA",
        "country": "USA",
        "postal_code": "95054",
        "location_type": "ADDRESS_POINT",
        "geo_coordinates": {
          "latitude": 37.39872,
          "longitude": -121.97663
        },
        "nav_coordinates": {
          "latitude": 37.39903,
          "longitude": -121.97727
        }
      }
    }
  ],
  "response_time": 21
}

Get Address Detail with Linked Entity

This feature retrieves detailed information about an Address and returns the related entities at the same time. This feature does not take effect when retrieving IDs of multiple entities.

Key methods

Method Details
setEntityIds(List entityIds) The unique id of the Address
setFacetParameters(FacetParameters facetParameters) Used to trigger the return of some additional facet attributes

Sample code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
String addressEntityId = "Yz1zYW50YSBjbGFyYTtjbz11cztzZm49Z3JlYXQgYW1lcmljYSBwa3d5O2g9NDY1NTt6PTk1MDU0O3M9Y2E7aWQ9MTA2NTI0MDYxO2x0PTM3LjM5ODE1O2xuPS0xMjEuOTc3ODk7cmdjPWZhbHNlOwV6";

entityClient.getDetailRequest()
    .setEntityIds(Arrays.asList(addressEntityId))
    .setFacetParameters(FacetParameters.builder()
        .addAdditionalFacetAttribute(AdditionalFacetAttributeType.LINKED_ENTITY)
        .build())
    .asyncCall(new Callback<EntityGetDetailResponse>() {

        @Override
        public void onSuccess(EntityGetDetailResponse response) {
            // log response in JSON format
            LOG.info(EntityJsonConverter.toPrettyJson(response));

            List<Entity> detailEntities = response.getResults();
            for (Entity entity : detailEntities) {
                if (entity.getType() == EntityType.PLACE) {
                    LOG.info("Found Place: " + entity.getPlace().getName());
                } else if (entity.getType() == EntityType.ADDRESS) {
                    LOG.info("Found Address: " + entity.getAddress().getFormattedAddress());
                }
            }
        }

        @Override
        public void onFailure(Throwable t) {
            LOG.error("Get unsuccessful response or throwable happened when executing the request.", t);
        }
    });
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
val addressEntityId = "Yz1zYW50YSBjbGFyYTtjbz11cztzZm49Z3JlYXQgYW1lcmljYSBwa3d5O2g9NDY1NTt6PTk1MDU0O3M9Y2E7aWQ9MTA2NTI0MDYxO2x0PTM3LjM5ODE1O2xuPS0xMjEuOTc3ODk7cmdjPWZhbHNlOwV6"

entityClient.getDetailRequest()
    .setEntityIds(listOf(addressEntityId))
    .setFacetParameters(FacetParameters.builder()
        .addAdditionalFacetAttribute(AdditionalFacetAttributeType.LINKED_ENTITY)
        .build())
    .asyncCall(object : Callback<EntityGetDetailResponse> {

        override fun onSuccess(response: EntityGetDetailResponse) {
            // log response in JSON format
            Log.i("sdk", EntityJsonConverter.toPrettyJson(response))

            val detailEntities = response.results
            for (entity in detailEntities) {
                if (entity.type == EntityType.PLACE) {
                    Log.i("sdk", "Found Place: ${entity.place.name}")
                } else if (entity.type == EntityType.ADDRESS) {
                    Log.i("sdk", "Found Address: ${entity.address.formattedAddress}")
                }
            }
        }

        override fun onFailure(t: Throwable) {
            Log.e("sdk", "Get unsuccessful response or throwable happened when executing the request.", t)
        }
    })

Response example

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
  "code": "SUCCESS",
  "message": "SUCCESS",
  "results": [
    {
      "id": "Yz1zYW50YSBjbGFyYTtjbz11cztzZm49Z3JlYXQgYW1lcmljYSBwa3d5O2g9NDY1NTt6PTk1MDU0O3M9Y2E7aWQ9MTA2NTI0MDYxO2x0PTM3LjM5ODE1O2xuPS0xMjEuOTc3ODk7cmdjPWZhbHNlOwV6",
      "type": "ADDRESS",
      "address": {
        "address_type": "STREET",
        "formatted_address": "4655 Great America Pkwy, Santa Clara CA 95054, USA",
        "house_number": "4655",
        "street": {
          "body": "great america",
          "type": "parkway",
          "formatted_name": "Great America Pkwy"
        },
        "city": "Santa Clara",
        "state": "CA",
        "country": "USA",
        "postal_code": "95054",
        "location_type": "ADDRESS_POINT",
        "geo_coordinates": {
          "latitude": 37.39903,
          "longitude": -121.97727
        },
        "nav_coordinates": {
          "latitude": 37.39903,
          "longitude": -121.97727
        },
        "address_lines": [
          "4655 Great America Pkwy, Santa Clara CA 95054, USA"
        ],
        "time_zone": "America/Los_Angeles"
      },
      "facets": {
        "related_entities": {
          "linked_entities": [
            {
              "id": "P-3633681",
              "type": "PLACE",
              "place": {
                "name": "Avaya",
                "phone_numbers": [
                  "8664618191"
                ],
                "categories": [
                  {
                    "id": "990",
                    "name": "Business facilities"
                  }
                ],
                "address": {
                  "formatted_address": "4655 Great America Pkwy, Santa Clara CA 95054, USA",
                  "house_number": "4655",
                  "street": {
                    "dirs": [
                    ],
                    "body": "Great America Pkwy",
                    "formatted_name": "Great America Pkwy"
                  },
                  "city": "Santa Clara",
                  "state": "CA",
                  "country": "USA",
                  "postal_code": "95054",
                  "geo_coordinates": {
                    "latitude": 37.39821,
                    "longitude": -121.97787
                  },
                  "nav_coordinates": {
                    "latitude": 37.39821,
                    "longitude": -121.97787
                  },
                  "address_lines": [
                    "4655 Great America Pkwy, Santa Clara CA 95054, USA"
                  ],
                  "time_zone": "America/Los_Angeles"
                },
                "websites": [
                  "http://www.avaya.com"
                ]
              }
            },
            {
              "id": "P-26938685",
              "type": "PLACE",
              "place": {
                "name": "Telenav",
                "phone_numbers": [
                  "4082453800"
                ],
                "categories": [
                  {
                    "id": "990",
                    "name": "Business facilities"
                  }
                ],
                "address": {
                  "formatted_address": "4655 Great America Pkwy, Santa Clara CA 95054, USA",
                  "house_number": "4655",
                  "street": {
                    "dirs": [
                    ],
                    "body": "Great America Pkwy",
                    "formatted_name": "Great America Pkwy"
                  },
                  "city": "Santa Clara",
                  "state": "CA",
                  "country": "USA",
                  "postal_code": "95054",
                  "geo_coordinates": {
                    "latitude": 37.39821,
                    "longitude": -121.97787
                  },
                  "nav_coordinates": {
                    "latitude": 37.39821,
                    "longitude": -121.97787
                  },
                  "address_lines": [
                    "4655 Great America Pkwy, Santa Clara CA 95054, USA"
                  ],
                  "time_zone": "America/Los_Angeles"
                },
                "websites": [
                  "http://www.telenav.com"
                ]
              }
            }
          ]
        }
      }
    }
  ],
  "response_time": 699
}