名前を使用してplacesを検索
このチュートリアルでは、名前を使用してplacesを検索する方法について説明します。
プロシージャ
マンハッタンのある場所から「自由の女神」を探すに (40.7307999,-73.9973085)
は、以下のリクエストを送信してください。
GET https://discover.search.hereapi.com/v1/
discover
?at=40.7307999,-73.9973085
&limit=2
&q=Statue+of+liberty
&apiKey={YOUR_API_KEY}
次のパラメータが使用されます。
- at - 座標で表された検索コンテキストの中心を指定
- Limit :返される結果の最大数
- Q - フリーテキストのクエリを入力します。
- apiKey - お客様の API キー 。
注
この要求は API キー 認証を使用します。 HERE platform の認証オプションの詳細については、『ID およびアクセス管理ガイド』を参照してください。
結果には、関連するロケーションオブジェクトに関する詳細情報が一覧表示されます。
{
"items": [
{
"title": "Statue of Liberty-New York Access",
"id": "here:pds:place:840dr5re-9f0b7cf123e84620a52771300e610edd",
"resultType": "place",
"address": {
"label": "Statue of Liberty-New York Access, 1 Battery Park, New York, NY 10004, United States",
"countryCode": "USA",
"countryName": "United States",
"stateCode": "NY",
"state": "New York",
"county": "New York",
"city": "New York",
"district": "Financial District",
"street": "Battery Park",
"postalCode": "10004",
"houseNumber": "1"
},
"position": { "lat": 40.70267, "lng": -74.01424 },
"access": [{ "lat": 40.70269, "lng": -74.01422 }],
"distance": 3438,
"categories": [
{ "id": "300-3000-0025", "name": "Historical Monument", "primary": true },
{ "id": "300-3000-0023", "name": "Tourist Attraction" },
{ "id": "300-3100-0000", "name": "Museum" }
],
"references": [
{ "supplier": { "id": "core" }, "id": "1217208922" },
{ "supplier": { "id": "core" }, "id": "17260966" },
{ "supplier": { "id": "core" }, "id": "17262185" }
],
"contacts": [
{
"phone": [{ "value": "+12123633200" }],
"www": [{ "value": "http://www.statueoflibertytickets.com" }]
}
]
},
{
"title": "Statue of Liberty",
"id": "here:pds:place:840dr5r7-9df1349708914ceba912909970598cf7",
"resultType": "place",
"address": {
"label": "Statue of Liberty, New York, NY 10004, United States",
"countryCode": "USA",
"countryName": "United States",
"stateCode": "NY",
"state": "New York",
"county": "New York",
"city": "New York",
"district": "Liberty Island",
"postalCode": "10004"
},
"position": { "lat": 40.68925, "lng": -74.04445 },
"access": [{ "lat": 40.68971, "lng": -74.04357 }],
"distance": 6094,
"categories": [
{ "id": "300-3000-0025", "name": "Historical Monument", "primary": true },
{ "id": "300-3000-0000", "name": "Landmark-Attraction" },
{ "id": "300-3000-0023", "name": "Tourist Attraction" },
{ "id": "300-3100-0000", "name": "Museum" }
],
"references": [
{ "supplier": { "id": "core" }, "id": "1098463183" },
{ "supplier": { "id": "core" }, "id": "1098463184" },
{ "supplier": { "id": "core" }, "id": "1217206957" },
{ "supplier": { "id": "core" }, "id": "17262184" },
{ "supplier": { "id": "core" }, "id": "899132706" },
{ "supplier": { "id": "tripadvisor" }, "id": "103887" },
{ "supplier": { "id": "yelp" }, "id": "gnZXpLFzKzdBeQfFz1h-2g" },
{ "supplier": { "id": "yelp" }, "id": "wB45aXh2cQlRWoKQzhWgeA" }
],
"contacts": [
{
"phone": [{ "value": "+12123633200" }],
"www": [
{ "value": "http://www.nps.gov/stli" },
{ "value": "https://www.nps.gov" }
]
}
]
}
]
}
エンドユーザーが自由の女神自身に関心を持っているか、ニューヨークからのアクセス権を持っている可能性があるため、これらのアイテムは両方とも返却されます。
/discover
パラメータの詳細については、次のトピックを参照してください。 API リファレンス。