周边查询(高级)
本文介绍通过阿里云OpenAPI SDK调用周边查询高级版接口的方法以及参数说明。
API概述
周边查询的自然语言接口,目前支持自然语言查询周边的酒店、餐厅、景点、休闲娱乐。
API定义
请求参数
参数名 | 含义及规则 | 是否必须 | 缺省值 | |
query | 搜索关键词 | 必填 | 无 | |
querySceneEnumCode | 搜索场景枚举: hotels - 酒店场景 attractions - 景点场景 restaurants - 餐厅场景 entertainment - 休闲娱乐场景 | 必填 | 无 |
响应参数
参数名 | 类型 | 说明 | ||
data | list | 返回的地点数据列表 | ||
id | string | 内部标识号 | ||
name | string | 名称 | ||
latitude | string | 位置的经度 | ||
longitude | string | 位置的纬度 | ||
types | string | 类型 | ||
typeCode | string | 类型编码 | ||
provinceName | string | 所属省份 | ||
provinceCode | string | 所属省份编码 | ||
cityName | string | 所属城市 | ||
cityCode | string | 所属城市编码 | ||
districtName | string | 所属区域 | ||
districtCode | string | 所属区域编码 | ||
address | string | 详细地址 | ||
metadata | object | 相关商业信息 | ||
phone | string | 联系电话 | ||
businessArea | string | 所属商圈 | ||
mainTag | string | 主标签 | ||
score | string | 评分 | ||
dailyOpeningHours | string | 今日营业时间 | ||
weeklyOpeningDays | string | 每周营业时间 | ||
images | list | 图片列表 | ||
title | string | 图片名称 | ||
url | string | 图片链接 |
示例
请求示例
{
"query":"杭州西湖附近的餐厅",
"querySceneEnumCode":"restaurants"
}
响应示例
{
"data": [
{
"id": "B0FFKYWI7R",
"name": "陕西科技大学南园餐厅",
"longitude": "108.976764",
"latitude": "34.380657",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "龙朔路与至博路交叉口西南240米",
"distanceMeter": "116",
"metadata": {
"mainTag": "食堂",
"score": "3.8",
"dailyOpeningHours": "06:00-21:00",
"weeklyOpeningDays": "每天"
},
"images": []
},
{
"id": "B0KB3KVG5G",
"name": "顶牛牛肉面(沁园小区店)",
"longitude": "108.975877",
"latitude": "34.381035",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "沁园小区东南门东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": "餐饮服务|中餐厅|特色/地方风味餐厅",
"typeCode": "050118",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "陕西科技大学时代广场六餐厅",
"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": "六餐厅(科大商场店)",
"longitude": "108.979896",
"latitude": "34.381616",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "龙朔路1科大商场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": "重庆豌杂面(科大商场店)",
"longitude": "108.979952",
"latitude": "34.381579",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"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": "杭州小笼包(科大商场店)",
"longitude": "108.979957",
"latitude": "34.381715",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "龙朔路1科大商场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": "憨豆特色夹馍(科大商场店)",
"longitude": "108.979977",
"latitude": "34.381646",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "龙朔路1科大商场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": "冒大仙(科大商场店)",
"longitude": "108.979993",
"latitude": "34.381715",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "龙朔路1科大商场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": "岐山擀面皮(科大时代广场店)",
"longitude": "108.980055",
"latitude": "34.381609",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "学府路2号科大时代广场F1层",
"distanceMeter": "216",
"metadata": {
"mainTag": "面馆",
"score": "3.5"
},
"images": [
{
"url": "http://store.is.autonavi.com/showpic/caf6d90530b9e48c7332c65aceb3d240"
}
]
},
{
"id": "B0FFKSYSPI",
"name": "爱简餐.轻食(科大商场店)",
"longitude": "108.980086",
"latitude": "34.381709",
"types": "餐饮服务|中餐厅|中餐厅",
"typeCode": "050100",
"provinceName": "陕西省",
"provinceCode": "610000",
"cityName": "西安市",
"cityCode": "029",
"districtName": "未央区",
"districtCode": "610112",
"address": "科大时代广场1楼餐饮区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"
}
]
}
]
}
错误码
HTTP Status | 错误码 | 错误信息 | 说明 | ||
400 | Throttling.User | Request was denied due to user flow control. | 用户限流错误 | ||
400 | MissingParameter | Required parameter xxx is not found. | 请求参数错误 | ||
403 | NotActivate | Please activate POI search service. | 未开通POI搜索服务 | ||
403 | NotAuthorised | Please authorize the AliyunIQSFullAccess privilege to the sub-account. | 子账号未被授权IQS权限 | ||
500 | InternalServerError | An unexpected error occurred | 系统内部错误 | ||
500 | ServiceUnavailable | Service unavailable | 服务不可用 |
SDK
SDK下载
服务接入点
地域名称 | 地域ID | 公网接入地址 |
华北3(张家口) | cn-zhangjiakou | iqs.cn-zhangjiakou.aliyuncs.com |
示例代码
以Java SDK配置和调用为例
SDK配置
通常建议使用最新版,以下内容仅为示例
<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;
}
}
调用示例
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
}