Search for a place using a category

This tutorial demonstrates how to search for places using their category.

Procedure

To search for hotels at the geo-position (42.36309,-71.05495) within a radius of 100m, send the following request:

GET https://discover.search.hereapi.com/v1/
    discover
    ?in=circle:42.36309,-71.05495;r=150
    &q=hotels
    &apiKey={YOUR_API_KEY}

The following parameters are used:

  • in - Search within a geographic area. Results will be returned if they are located within the specified area.
  • q - Enter a free-text query.
  • apiKey - Your API key.

Note

This request uses API key authentication. For more information about authentication options on the HERE platform, see the Identity & Access Management Guide.

The result lists detailed information about the related location objects:

{
  "items": [
    {
      "title": "Bricco",
      "id": "here:pds:place:840drt2z-da7d929da56241ab90a63e9b04581a3e",
      "ontologyId": "here:cm:ontology:hotel",
      "resultType": "place",
      "address": {
        "label": "Bricco, 241 Hanover St, Boston, MA 02113, United States",
        "countryCode": "USA",
        "countryName": "United States",
        "stateCode": "MA",
        "state": "Massachusetts",
        "county": "Suffolk",
        "city": "Boston",
        "district": "North End",
        "street": "Hanover St",
        "postalCode": "02113",
        "houseNumber": "241"
      },
      "position": { "lat": 42.36309, "lng": -71.05495 },
      "access": [{ "lat": 42.36315, "lng": -71.05511 }],
      "distance": 0,
      "categories": [
        { "id": "500-5000-0000", "name": "Hotel/Motel", "primary": true },
        { "id": "100-1000-0000", "name": "Restaurant" },
        { "id": "100-1000-0001", "name": "Casual Dining" },
        { "id": "500-5000-0053", "name": "Hotel" }
      ],
      "references": [
        { "supplier": { "id": "core" }, "id": "1210790443" },
        { "supplier": { "id": "core" }, "id": "1212952865" },
        { "supplier": { "id": "core" }, "id": "31259419" },
        { "supplier": { "id": "tripadvisor" }, "id": "322039" },
        { "supplier": { "id": "tripadvisor" }, "id": "3952875" },
        { "supplier": { "id": "yelp" }, "id": "55PGG2U1z-q7Z694F-B-_w" },
        { "supplier": { "id": "yelp" }, "id": "HeUnLUCbZp14okbOuUQuig" }
      ],
      "foodTypes": [{ "id": "304-000", "name": "Italian", "primary": true }, { "id": "800-075", "name": "Seafood" }],
      "contacts": [
        {
          "phone": [{ "value": "+16172486800" }, { "value": "+16174591293" }],
          "fax": [{ "value": "+16173670666" }],
          "www": [
            { "value": "http://www.bricco.com" },
            { "value": "https://briccosuites.com" }
          ],
          "email": [{ "value": "briccosuites@dventures.net" }]
        }
      ],
      "openingHours": [
        {
          "text": ["Mon-Sat: 00:00 - 23:00", "Sun: 16:00 - 23:00"],
          "isOpen": true,
          "structured": [
            { "start": "T000000", "duration": "PT23H59M", "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA" },
            { "start": "T160000", "duration": "PT07H00M", "recurrence": "FREQ:DAILY;BYDAY:SU" }
          ]
        }
      ]
    },
    {
      "title": "Mariners House",
      "id": "here:pds:place:840drt3p-352341af037d4adebf8cf857356b53db",
      "ontologyId": "here:cm:ontology:hotel",
      "resultType": "place",
      "address": {
        "label": "Mariners House, 11 North Sq, Boston, MA 02113, United States",
        "countryCode": "USA",
        "countryName": "United States",
        "stateCode": "MA",
        "state": "Massachusetts",
        "county": "Suffolk",
        "city": "Boston",
        "district": "North End",
        "street": "North Sq",
        "postalCode": "02113",
        "houseNumber": "11"
      },
      "position": { "lat": 42.36391, "lng": -71.05362 },
      "access": [{ "lat": 42.36388, "lng": -71.0535 }],
      "distance": 142,
      "categories": [
        { "id": "500-5000-0000", "name": "Hotel/Motel", "primary": true },
        { "id": "200-2000-0000", "name": "Nightlife-Entertainment" },
        { "id": "300-3000-0000", "name": "Landmark-Attraction" },
        { "id": "500-5000-0053", "name": "Hotel" }
      ],
      "references": [{ "supplier": { "id": "core" }, "id": "1211051251" }],
      "contacts": [
        {
          "phone": [{ "value": "+16172270564" }, { "value": "+16172273979" }, { "value": "+16172274201" }],
          "fax": [{ "value": "+18777329494" }],
          "www": [
            { "value": "http://www.marinershouse.org/" }
          ],
          "email": [{ "value": "inn@marinershouse.org" }]
        }
      ],
      "openingHours": [
        {
          "text": ["Mon-Sun: 00:00 - 24:00"],
          "isOpen": true,
          "structured": [
            { "start": "T000000", "duration": "PT24H00M", "recurrence": "FREQ:DAILY;BYDAY:MO,TU,WE,TH,FR,SA,SU" }
          ]
        }
      ]
    }
  ]
}

Additional information

For more information about /discover parameters, see: API Reference.

results matching ""

    No results matching ""