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 Details

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
ids(ids: [String]) The unique id list of the address or POI entity

Sample code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
let entityID = "Yz1zYW50YSBjbGFyYTtjbz11cztzZm49Z3JlYXQgYW1lcmljYSBwa3d5O2g9NDY1NTt6PTk1MDU0O3M9Y2E7aWQ9MTA2NTI0MDYxO2x0PTM3LjM5ODE1O2xuPS0xMjEuOTc3ODk7cmdjPWZhbHNlOwV6";
let getDetailParams = TNEntityDetailParamsBuilder()
    .ids([entityID])
    .build()

TNEntityClient.getEntityDetail(params: getDetailParams) { (response, err) in
    if let entities = response?.results {
        for entity in entities {

        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
NSString *entityID = @"Yz1zYW50YSBjbGFyYTtjbz11cztzZm49Z3JlYXQgYW1lcmljYSBwa3d5O2g9NDY1NTt6PTk1MDU0O3M9Y2E7aWQ9MTA2NTI0MDYxO2x0PTM3LjM5ODE1O2xuPS0xMjEuOTc3ODk7cmdjPWZhbHNlOwV6";

TNEntityDetailParams *params = [[[TNEntityDetailParamsBuilder new]
                          ids:@[entityID]] build];
[TNEntityClient getEntityDetailWithParams:params completion:^(TNEntityDetailResult * _Nullable res, NSError * _Nullable err) {
    if (res.results && res.results.count > 0) {
        for (TNEntity *ent in res.results) {

        }
    }
}];

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
{
  "status": {
      "status": 12200,
      "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
}