周邊查詢(高級(jí))
本文介紹通過(guò)阿里云OpenAPI SDK調(diào)用周邊查詢高級(jí)版接口的方法以及參數(shù)說(shuō)明。
API概述
周邊查詢的自然語(yǔ)言接口,目前支持自然語(yǔ)言查詢周邊的酒店、餐廳、景點(diǎn)、休閑娛樂(lè)。
API定義
請(qǐng)求參數(shù)
參數(shù)名 | 含義及規(guī)則 | 是否必須 | 缺省值 | |
query | 搜索關(guān)鍵詞 | 必填 | 無(wú) | |
querySceneEnumCode | 搜索場(chǎng)景枚舉: hotels - 酒店場(chǎng)景 attractions - 景點(diǎn)場(chǎng)景 restaurants - 餐廳場(chǎng)景 entertainment - 休閑娛樂(lè)場(chǎng)景 | 必填 | 無(wú) |
響應(yīng)參數(shù)
參數(shù)名 | 類型 | 說(shuō)明 | ||
data | list | 返回的地點(diǎn)數(shù)據(jù)列表 | ||
id | string | 內(nèi)部標(biāo)識(shí)號(hào) | ||
name | string | 名稱 | ||
latitude | string | 位置的經(jīng)度 | ||
longitude | string | 位置的緯度 | ||
types | string | 類型 | ||
typeCode | string | 類型編碼 | ||
provinceName | string | 所屬省份 | ||
provinceCode | string | 所屬省份編碼 | ||
cityName | string | 所屬城市 | ||
cityCode | string | 所屬城市編碼 | ||
districtName | string | 所屬區(qū)域 | ||
districtCode | string | 所屬區(qū)域編碼 | ||
address | string | 詳細(xì)地址 | ||
metadata | object | 相關(guān)商業(yè)信息 | ||
phone | string | 聯(lián)系電話 | ||
businessArea | string | 所屬商圈 | ||
mainTag | string | 主標(biāo)簽 | ||
score | string | 評(píng)分 | ||
dailyOpeningHours | string | 今日營(yíng)業(yè)時(shí)間 | ||
weeklyOpeningDays | string | 每周營(yíng)業(yè)時(shí)間 | ||
images | list | 圖片列表 | ||
title | string | 圖片名稱 | ||
url | string | 圖片鏈接 |
示例
請(qǐng)求示例
{
"query":"杭州西湖附近的餐廳",
"querySceneEnumCode":"restaurants"
}
響應(yīng)示例
{
"data": [
{
"id": "B0FFKYWI7R",
"name": "陜西科技大學(xué)南園餐廳",
"longitude": "108.976764",
"latitude": "34.380657",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "龍朔路與至博路交叉口西南240米",
"distanceMeter": "116",
"metadata": {
"mainTag": "食堂",
"score": "3.8",
"dailyOpeningHours": "06:00-21:00",
"weeklyOpeningDays": "每天"
},
"images": []
},
{
"id": "B0KB3KVG5G",
"name": "頂牛牛肉面(沁園小區(qū)店)",
"longitude": "108.975877",
"latitude": "34.381035",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "沁園小區(qū)東南門(mén)東160米",
"distanceMeter": "172",
"metadata": {
"mainTag": "牛肉面",
"score": "3.7"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/91b11bde8117c68c4ff8ccba9d8ecaef"
}
]
},
{
"id": "B0JR59019M",
"name": "東北王麻辣燙(科大店)",
"longitude": "108.979816",
"latitude": "34.381693",
"types": "餐飲服務(wù)|中餐廳|特色/地方風(fēng)味餐廳",
"typeCode": "050118",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "陜西科技大學(xué)時(shí)代廣場(chǎng)六餐廳",
"distanceMeter": "196",
"metadata": {
"phone": "1520918****",
"mainTag": "小吃快餐",
"score": "3.8",
"dailyOpeningHours": "09:30-22:00",
"weeklyOpeningDays": "每天",
"tag": "麻辣燙"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/f1f2f8fa10af15ea7282cb1af43eb3be"
},
{
"url": "http://store.is.autonavi.com/showpic/98f40ac962d5ee264a6ed1c1638d59da"
},
{
"url": "http://store.is.autonavi.com/showpic/8157da676ab66d8e305529eb025db03b"
}
]
},
{
"id": "B001D15KOS",
"name": "六餐廳(科大商場(chǎng)店)",
"longitude": "108.979896",
"latitude": "34.381616",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "龍朔路1科大商場(chǎng)F2層",
"distanceMeter": "202",
"metadata": {
"phone": "1357198****|1860191****",
"mainTag": "中餐",
"score": "4.2",
"dailyOpeningHours": "10:00-22:00",
"weeklyOpeningDays": "每天",
"averageSpend": "11.00"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/38923c75cc0122aac36cecd56e5e6af3"
},
{
"url": "http://store.is.autonavi.com/showpic/417d16ddc756080c68c705892135c21f"
}
]
},
{
"id": "B0KGSCLOQI",
"name": "重慶豌雜面(科大商場(chǎng)店)",
"longitude": "108.979952",
"latitude": "34.381579",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "陜科大沁園六餐廳二樓",
"distanceMeter": "207",
"metadata": {
"phone": "1330923****|1851663****",
"mainTag": "小吃快餐",
"score": "3.8",
"dailyOpeningHours": "09:00-22:00",
"weeklyOpeningDays": "每天"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/d7ab84254ad3b78a352c0ee2b5854630"
},
{
"url": "http://store.is.autonavi.com/showpic/067e6cd57c0cbb3b71fc21c0b174067e"
}
]
},
{
"id": "B0FFFDCVRV",
"name": "杭州小籠包(科大商場(chǎng)店)",
"longitude": "108.979957",
"latitude": "34.381715",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "龍朔路1科大商場(chǎng)F1層",
"distanceMeter": "210",
"metadata": {
"phone": "1775752****",
"mainTag": "小籠包",
"score": "4.0",
"dailyOpeningHours": "07:00-21:00",
"weeklyOpeningDays": "周一至周日",
"averageSpend": "10.00"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/37f19cc70e4c4bde3b6dfe92bfc5a2a0"
},
{
"url": "http://store.is.autonavi.com/showpic/96feeb41499633ad6e38bb677c56e33e"
},
{
"url": "http://store.is.autonavi.com/showpic/7d6b82988c96054c702265fc61417ee4"
}
]
},
{
"id": "B0H1ML0ZMW",
"name": "憨豆特色夾饃(科大商場(chǎng)店)",
"longitude": "108.979977",
"latitude": "34.381646",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "龍朔路1科大商場(chǎng)F1層",
"distanceMeter": "210",
"metadata": {
"mainTag": "肉夾饃",
"score": "3.5"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/8d0871b399c567f89499be222f20ce91"
},
{
"url": "http://store.is.autonavi.com/showpic/4bc50af7b0219c3a64af4cfc607961ab"
},
{
"url": "http://store.is.autonavi.com/showpic/f454ae95a6ad357e45e79290f8552f5c"
}
]
},
{
"id": "B0JGTCPVO2",
"name": "冒大仙(科大商場(chǎng)店)",
"longitude": "108.979993",
"latitude": "34.381715",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "龍朔路1科大商場(chǎng)F1層",
"distanceMeter": "213",
"metadata": {
"phone": "1862928****",
"mainTag": "冒菜",
"score": "4.2"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/568754d5a2ce07f6b2c3f1239aa227c6"
},
{
"url": "http://s-pic.oss-cn-beijing.aliyuncs.com/desensitize/images/publish/bcb78a931a4a47e9af4b57fe2b96c79f.jpg"
},
{
"url": "http://store.is.autonavi.com/showpic/3ece0529735b7b1df0e8cda49db294f0"
}
]
},
{
"id": "B0KBRCSK5V",
"name": "岐山搟面皮(科大時(shí)代廣場(chǎng)店)",
"longitude": "108.980055",
"latitude": "34.381609",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "學(xué)府路2號(hào)科大時(shí)代廣場(chǎng)F1層",
"distanceMeter": "216",
"metadata": {
"mainTag": "面館",
"score": "3.5"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/caf6d90530b9e48c7332c65aceb3d240"
}
]
},
{
"id": "B0FFKSYSPI",
"name": "愛(ài)簡(jiǎn)餐.輕食(科大商場(chǎng)店)",
"longitude": "108.980086",
"latitude": "34.381709",
"types": "餐飲服務(wù)|中餐廳|中餐廳",
"typeCode": "050100",
"provinceName": "陜西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央?yún)^(qū)",
"districtCode": "610112",
"address": "科大時(shí)代廣場(chǎng)1樓餐飲區(qū)1-1-90",
"distanceMeter": "221",
"metadata": {
"phone": "1582932****",
"mainTag": "小吃快餐",
"score": "4.1",
"dailyOpeningHours": "09:30-20:30",
"weeklyOpeningDays": "每天"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/a3f1ed680bf38075b57fc64aceee0e48"
},
{
"url": "http://s-pic.oss-cn-beijing.aliyuncs.com/desensitize/deep/images/publish/58d371d315c81ddba4474567a1b732d0.jpg"
},
{
"url": "http://store.is.autonavi.com/showpic/33ab6c4525f7720691862c052f9cbf48"
}
]
}
]
}
錯(cuò)誤碼
HTTP Status | 錯(cuò)誤碼 | 錯(cuò)誤信息 | 說(shuō)明 | ||
400 | Throttling.User | Request was denied due to user flow control. | 用戶限流錯(cuò)誤 | ||
400 | MissingParameter | Required parameter xxx is not found. | 請(qǐng)求參數(shù)錯(cuò)誤 | ||
403 | NotActivate | Please activate POI search service. | 未開(kāi)通POI搜索服務(wù) | ||
403 | NotAuthorised | Please authorize the AliyunIQSFullAccess privilege to the sub-account. | 子賬號(hào)未被授權(quán)IQS權(quán)限 | ||
500 | InternalServerError | An unexpected error occurred | 系統(tǒng)內(nèi)部錯(cuò)誤 | ||
500 | ServiceUnavailable | Service unavailable | 服務(wù)不可用 |
SDK
SDK下載
服務(wù)接入點(diǎn)
地域名稱 | 地域ID | 公網(wǎng)接入地址 |
華北3(張家口) | cn-zhangjiakou | iqs.cn-zhangjiakou.aliyuncs.com |
示例代碼
以Java SDK配置和調(diào)用為例
SDK配置
通常建議使用最新版,以下內(nèi)容僅為示例
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>iqs20240712</artifactId>
<version>2.0.3</version>
</dependency>
客戶端配置
@Configuration
public class ClientConfiguration {
@Bean
public Client clientConfig() throws Exception {
Config config = new Config();
config.setAccessKeyId("XXX");
config.setAccessKeySecret("XXX");
config.setEndpoint("iqs.cn-zhangjiakou.aliyuncs.com");
config.setConnectTimeout(8000);
Client client = new Client(config);
return client;
}
}
調(diào)用示例
CommonQueryBySceneRequest queryAttractionsRequest = new CommonQueryBySceneRequest();
CommonAgentQuery commonAgentQuery = new CommonAgentQuery();
commonAgentQuery.setQuery("杭州西湖附近的高檔酒店");
commonAgentQuery.setQuerySceneEnumCode(QuerySceneEnum.HOTEL.getCode());
queryAttractionsRequest.setBody(commonAgentQuery);
try {
CommonQueryBySceneResponse commonQueryBySceneResponse = client.commonQueryByScene(queryAttractionsRequest);
System.out.println(JSON.toJSONString(commonQueryBySceneResponse));
} catch (Exception e) {
//log error
}