CleverSee vertical search: Nearby Search API

Updated at:

> Call the CommonQueryByScene API to search for nearby Points of Interest (POIs) using natural language.

API

API name: CommonQueryByScene

This API enables natural language searches for nearby Points of Interest (POIs). It supports queries for all POI types and returns structured fields such as name, type, administrative division, address, distance from the center point, and commercial information. For specific business scenarios, you can pass a scene parameter to limit the search scope, which improves accuracy and response time. If you omit this parameter, the model automatically infers the scene.

The billing method is "Nearby Search", charged on a pay-per-use basis. For pricing and metering details, see Vertical Query - Billing Information.

Note

The default performance specification for new purchases is 5 QPS (Queries Per Second). If you need a higher limit, contact your business manager at least one week in advance.

API definition

Request parameters

Parameter

Description

Required

Default

query

The search query, which supports natural language descriptions. For example: "high-end hotels within 5 km of Lingyin Temple in Hangzhou".

Yes

None

querySceneEnumCode

The search scene. Valid values: hotels, attractions, restaurants, and entertainment. If you omit this parameter, the model automatically infers the scene.

No

None

limit

The maximum number of results to return.

No

10

searchModel

The search mode. single: concise mode, returns only a subset of fields such as name, types, address, and metadata. normal: standard mode, returns all available fields.

No

normal

Response parameters

Parameter

Type

Description

requestId

string

A unique ID for the request.

data

list

A list of returned POIs.

data[].id

string

The internal identifier.

data[].name

string

The POI name.

data[].latitude

string

The latitude.

data[].longitude

string

The longitude.

data[].types

string

The POI type. Multiple levels are separated by vertical bars (|), for example, "Accommodation Services|Hotels|Five-star Hotel".

data[].typeCode

string

The type code.

data[].provinceName

string

The province name.

data[].provinceCode

string

The province code.

data[].cityName

string

The city name.

data[].cityCode

string

The city code.

data[].districtName

string

The district name.

data[].districtCode

string

The district code.

data[].address

string

The full address.

data[].distanceMeter

string

The distance from the center point, in meters.

data[].metadata

object

Related commercial information.

data[].metadata.phone

string

The contact phone numbers, with multiple numbers separated by vertical bars (|).

data[].metadata.businessArea

string

The business area.

data[].metadata.mainTag

string

The primary tag.

data[].metadata.score

string

The rating.

data[].metadata.dailyOpeningHours

string

Today's opening hours.

data[].metadata.weeklyOpeningDays

string

The weekly opening days.

data[].metadata.averageSpend

string

The average spend, in CNY.

data[].images

list

A list of images.

data[].images[].title

string

The image title.

data[].images[].url

string

The image URL.

Examples

Request example

{
  "query": "high-end hotels within 5km of Lingyin Temple in Hangzhou",
  "querySceneEnumCode": "hotels"
}

Response example

{
  "requestId": "15A85F99-408F-5BFA-B617-0C7D3E732ABD",
  "data": [
    {
      "id": "B023B0BI3J",
      "name": "Amanfayun",
      "latitude": "30.234403",
      "longitude": "120.097327",
      "types": "Accommodation Services|Hotels|Five-star Hotel",
      "typeCode": "100102",
      "provinceName": "Zhejiang Province",
      "provinceCode": "330000",
      "cityName": "Hangzhou",
      "cityCode": "0571",
      "districtName": "Xihu District",
      "districtCode": "330106",
      "distanceMeter": "815",
      "address": "22 Fayun Lane, West Lake Scenic Area",
      "metadata": {
        "phone": "0571-8732****",
        "businessArea": "Central area of the West Lake scenic area",
        "mainTag": "Luxury",
        "score": "4.7",
        "dailyOpeningHours": null,
        "weeklyOpeningDays": null,
        "averageSpend": null
      },
      "images": [
        {
          "title": null,
          "url": "http://store.example.com/showpic/6ca3129317745e14b893e731408c9610"
        }
      ]
    },
    {
      "id": "B023B03721",
      "name": "Hangzhou Jiuli Yun-sung Resort Hotel",
      "latitude": "30.244454",
      "longitude": "120.113209",
      "types": "Accommodation Services|Hotels|Five-star Hotel",
      "typeCode": "100102",
      "provinceName": "Zhejiang Province",
      "provinceCode": "330000",
      "cityName": "Hangzhou",
      "cityCode": "0571",
      "districtName": "Xihu District",
      "districtCode": "330106",
      "distanceMeter": "1204",
      "address": "18-8 Lingyin Road",
      "metadata": {
        "phone": "0571-8798****",
        "businessArea": "West Lake",
        "mainTag": "Luxury",
        "score": "4.8",
        "dailyOpeningHours": null,
        "weeklyOpeningDays": null,
        "averageSpend": null
      },
      "images": [
        {
          "title": "Lobby",
          "url": "http://store.example.com/showpic/e76beb3bedca3fe0375cef12742ea23e"
        }
      ]
    }
  ]
}
Note

The preceding response is a sample. The limit parameter, which defaults to 10, determines the number of items returned.

Calling the API

Call this API using an Alibaba Cloud OpenAPI SDK. Authentication requires an AccessKey ID and AccessKey Secret. The service endpoint is:

Region

Region ID

Endpoint

China (Zhangjiakou)

cn-zhangjiakou

iqs.cn-zhangjiakou.aliyuncs.com

For Python, install the alibabacloud_iqs20240712 SDK. For Java, use the Maven coordinate com.aliyun:iqs20240712. We recommend using the latest version.

Python example:

from alibabacloud_iqs20240712.client import Client as IQS20240712Client
from alibabacloud_iqs20240712.models import CommonAgentQuery
from alibabacloud_iqs20240712 import models as iqs20240712_models
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_tea_util import models as util_models

config = open_api_models.Config(
    access_key_id='$YOUR_ACCESS_KEY_ID',
    access_key_secret='$YOUR_ACCESS_KEY_SECRET'
)
config.endpoint = 'iqs.cn-zhangjiakou.aliyuncs.com'
client = IQS20240712Client(config)

request = iqs20240712_models.CommonQueryBySceneRequest(
    body=CommonAgentQuery(
        query="high-end hotels within 5km of Lingyin Temple in Hangzhou",
        query_scene_enum_code="hotels"
    )
)
resp = client.common_query_by_scene_with_options(request, {}, util_models.RuntimeOptions())
print(resp)

For sample code in Java and Go, as well as information on MCP and Skill integration, see the "Integration Methods" topic.

Error codes

HTTP status

Error code

Error message

Description

400

Throttling.User

Request was denied due to user flow control.

The request was denied due to user-level throttling.

400

MissingParameter

Required parameter xxx is not found.

A required parameter is missing from the request.

403

NotActivate

Please activate POI search service.

The POI search service is not activated.

403

NotAuthorised

Please authorize the AliyunIQSFullAccess privilege to the sub-account.

The RAM user is not authorized to access IQS.

500

InternalServerError

An unexpected error occurred

An internal server error occurred.

500

ServiceUnavailable

Service unavailable

The service is unavailable.

Related topics