> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 设置 Google 酒店搜索任务

> Hotel Searches API 提供包含 Google 所列不同酒店信息的结果。



## OpenAPI

````yaml openapi/zh/dataforseo.json POST /dataforseo/business_data/google/hotel_searches/task_post
openapi: 3.0.3
info:
  title: DataForSEO API
  version: 1.0.0
  description: 通过 AIsa 统一网关提供的 DataForSEO API 端点。
servers:
  - url: https://api.aisa.one/apis/v1
security:
  - BearerAuth: []
paths:
  /dataforseo/business_data/google/hotel_searches/task_post:
    post:
      summary: 设置 Google 酒店搜索任务
      description: >-
        Hotel Searches API 提供包含 Google
        上所列不同酒店信息的结果。提供的结果取决于关键词、所选位置（请参阅[位置列表](https://docs.dataforseo.com/v3/business_data/google/locations.md)）和语言（请参阅[语言列表](https://docs.dataforseo.com/v3/business_data/google/languages.md)）设置。
      operationId: post_dataforseo_business_data_google_hotel_searches_task_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                keyword:
                  type: string
                  description: >-
                    *keyword*
                    可选字段，您指定的关键词用于搜索酒店列表；如果不使用此字段，我们将返回在指定位置找到的酒店列表；您可以在
                    `keyword` 字段中指定**最多 700 个字符**，**所有 %##
                    都将被解码（加号字符“+”将被解码为空格字符）**；如果需要在 `keyword`
                    中使用“%”字符，请将其指定为“%25”；**注意：**为获得准确的搜索结果，位置名称会自动附加到关键词中。有关
                    DataForSEO API 中 `keyword` 和 `keywords`
                    字段的规则与限制，请参阅这篇[帮助中心文章](https://dataforseo.com/help-center/rules-and-limitations-of-keyword-and-keywords-fields-in-dataforseo-apis)
                priority:
                  type: integer
                  description: >-
                    *任务优先级* 可选字段 可采用以下值：1 – 普通执行优先级（默认设置）2 – 高执行优先级
                    使用高执行优先级的任务将额外收费。费用可在[定价](https://dataforseo.com/pricing/business-data/google-hotels-api
                    "定价")页面计算。
                location_name:
                  type: string
                  description: >-
                    *搜索引擎位置的完整名称*。**如果未指定 `location_code` 或
                    `location_coordinate`，则为必填字段**。**如果使用此字段，则无需指定
                    `location_code` 或 `location_coordinate`**。可以通过向
                    `https://api.dataforseo.com/v3/business_data/google/locations`
                    单独发起请求，获取包含 `location_name`
                    的可用位置列表。示例：`London,England,United
                    Kingdom`。**注意：**为获得准确的搜索结果，您指定的 `location_name` 将自动附加到关键词中
                location_code:
                  type: integer
                  description: >-
                    *搜索引擎位置代码* **如果未指定 `location_name` 或
                    `location_coordinate`，则为必填字段** **如果使用此字段，则无需指定
                    `location_name` 或 `location_coordinate`** 可通过向
                    `https://api.dataforseo.com/v3/business_data/google/locations`
                    单独发送请求，获取包含 `location_code` 的可用位置列表。示例：`2840`
                location_coordinate:
                  type: string
                  description: >-
                    *位置的 GPS 坐标* **如果未指定 `location_name` 或
                    `location_code`，则为必填字段** **如果使用此字段，则无需指定 `location_name` 或
                    `location_code`** `location_coordinate` 参数应以
                    *“latitude,longitude”* 格式指定 *“latitude”* 和 *“longitude”*
                    的最大小数位数：7
                    **注意**：如果使用坐标设置位置，搜索将在最近的居民点进行；示例：`53.476225,-2.243572`
                language_name:
                  type: string
                  description: >-
                    *搜索引擎语言的完整名称* **如果未指定 `language_code`，则为必填字段**
                    **如果使用此字段，则无需指定 `language_code`** 您可以通过向
                    `https://api.dataforseo.com/v3/business_data/google/languages`
                    单独发送请求，获取包含 `language_name` 的可用语言列表。示例：`English`
                language_code:
                  type: string
                  description: >-
                    *搜索引擎语言代码* **如果未指定 `language_name`，则为必填字段** **如果使用此字段，则无需指定
                    `language_name`** 可通过向
                    `https://api.dataforseo.com/v3/business_data/google/languages`
                    单独发送请求，获取可用语言及其 `language_code` 的列表 示例：`en`
                depth:
                  type: integer
                  description: >-
                    *解析深度* 可选字段 Google Hotels 中的结果数量 默认值：`20` 条自然搜索结果 最大值：`140`
                    **注意：**无论响应中是否包含付费列表，您的账户都将按每 20 条自然搜索结果计费；因此，如果 Google
                    Hotels 返回超过 20 条结果，将深度设置为高于 `20`
                    可能产生额外费用；如果指定的深度高于响应中的结果数量，差额将自动退还至您的账户余额
                check_in:
                  type: string
                  description: >-
                    *入住日期* 可选字段 如果未指定此字段，默认使用明天的日期；日期格式：`"yyyy-mm-dd"`
                    示例：`"2019-01-15"` **注意：**该值不能早于今天的日期
                check_out:
                  type: string
                  description: >-
                    *退房日期*；可选字段；如果未指定此字段，系统将默认使用从现在起两天后的日期；日期格式：`"yyyy-mm-dd"`；示例：`"2019-01-15"`；**注意：**该值不能小于或等于
                    `check_in`；`check_in` 与 `check_out` 值之间的范围不能超过 30 天
                currency:
                  type: string
                  description: '*货币* 可选字段示例：`"USD"`'
                adults:
                  type: integer
                  description: >-
                    *成人人数*，可选字段；如果未指定此字段，将应用默认值 `2`；**注意**，成人和儿童合计最多可指定 6
                    人；示例：`1`
                children:
                  type: array
                  items:
                    type: string
                  description: >-
                    *儿童人数和年龄*。可选字段。如果不指定此字段，搜索中将不包含儿童；儿童年龄范围为 `0` 至
                    `17`；**注意**，成人和儿童合计最多可指定 6 人。如果要包含一名 14
                    岁儿童，请设置以下值：`[14]`；如果要包含一名 13 岁儿童和一名 8 岁儿童，请设置以下值：`[13,8]`
                stars:
                  type: array
                  items:
                    type: string
                  description: '*酒店星级* 可选字段；如果只想获取五星级酒店列表，请将此字段设置为 `[5]`，例如：`[3,4,5]`'
                min_rating:
                  type: number
                  description: '*最低评分* 可选字段；您可以使用此字段指定高于某个值的住客评分，例如：`2.5`'
                sort_by:
                  type: string
                  description: >-
                    *结果排序参数* 可选字段。您可以使用此字段对结果进行排序。可选排序类型：`relevance` –
                    按相关性从高到低排序；`lowest_price` – 按价格从低到高排序；`highest_rating` –
                    按评分从高到低排序；`most_reviewed` – 按评论数量从多到少排序。默认值：`relevance`
                min_price:
                  type: integer
                  description: '*每晚最低价格* 可选字段，此值的货币取决于 `currency` 字段；示例：`100`'
                max_price:
                  type: integer
                  description: '*每晚最高价格* 可选字段，此值的货币取决于 `currency` 字段，例如：`600`'
                free_cancellation:
                  type: boolean
                  description: >-
                    *可免费取消的酒店*，可选字段。如果希望获取可免费取消预订的酒店列表，请将此字段设置为
                    `true`。默认值：`false`
                is_vacation_rentals:
                  type: boolean
                  description: >-
                    *搜索度假租赁住宿* 可选字段；如果希望获取度假租赁住宿列表而非酒店列表，请将此字段设置为
                    `true`；默认值：`false`。
                amenities:
                  type: array
                  items:
                    type: string
                  description: >-
                    *酒店设施*。可选字段。可使用此字段指定不同的酒店设施。示例：` [ "free_parking",
                    "pets_allowed"
                    ]`。可用值：`"air_conditioning","all_inclusive_available","bar","free_breakfast","fitness_center","kid_friendly","free_parking","pets_allowed","pool","restaurant","room_service","spa","free_wifi","parking","indoor_pool","outdoor_pool","wheelchair_accessible","beach_access"`
                tag:
                  type: string
                  description: >-
                    *用户定义的任务标识符*，可选字段，*字符数上限为 255*。你可以使用此参数标识任务并将其与结果匹配；你可以在响应的
                    `data` 对象中找到指定的 `tag` 值
                postback_url:
                  type: string
                  description: >-
                    *用于发送任务结果的返回 URL*，可选字段。任务完成后，我们会向您指定的 `postback_url` 发送 POST
                    请求，结果将以 `gzip` 格式压缩。您可以将字符串 ‘$id’ 用作 `$id` 变量，并将 ‘$tag’ 用作经过
                    URL 编码的 `$tag`
                    变量。我们将在发送请求前设置必要的值。示例：`http://your-server.com/postbackscript?id=$id`
                    `http://your-server.com/postbackscript?id=$id&tag=$tag`
                    **注意：**`postback_url` 中的特殊字符将经过 URL 编码；例如，`#` 字符将编码为
                    `%23`。有关更多信息，请参阅我们的[帮助中心](https://dataforseo.com/help-center/pingbacks-postbacks-with-dataforseo-api)
                pingback_url:
                  type: string
                  description: >-
                    *任务完成通知 URL*，可选字段。任务完成后，我们将向你指定的 URL 发送 GET 请求以通知你。你可以使用字符串
                    ‘$id’ 作为 `$id` 变量，并使用 ‘$tag’ 作为经过 URL 编码的 `$tag`
                    变量。我们会在发送请求前设置必要的值。示例：`http://your-server.com/pingscript?id=$id`
                    `http://your-server.com/pingscript?id=$id&tag=$tag`
                    **注意：**`pingback_url` 中的特殊字符将进行 URL 编码；例如，`#` 字符将被编码为
                    `%23`。请访问我们的[帮助中心](https://dataforseo.com/help-center/pingbacks-postbacks-with-dataforseo-api)了解更多信息。
              required:
                - location_name
                - location_code
                - location_coordinate
                - language_name
                - language_code
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  version:
                    type: string
                    description: '*API 的当前版本*'
                  version.status_code:
                    type: integer
                    description: >-
                      *常规状态代码*
                      您可以在[此处](https://docs.dataforseo.com/v3/appendix/errors.md)查看完整的响应代码列表。**注意：**我们强烈建议设计必要的系统来处理相关异常或错误情况
                  version.status_message:
                    type: string
                    description: >-
                      *一般信息消息*
                      你可以在[此处](https://docs.dataforseo.com/v3/appendix/errors.md)查看一般信息消息的完整列表
                  version.time:
                    type: string
                    description: '*执行时间（秒）*'
                  version.cost:
                    type: number
                    description: '*任务总成本（美元）*'
                  version.tasks_count:
                    type: integer
                    description: '***`tasks`**数组中的任务数量*'
                  version.tasks_error:
                    type: integer
                    description: '*返回的 **`tasks`** 数组中发生错误的任务数量*'
                  tasks:
                    type: array
                    items:
                      type: string
                    description: '*任务数组*'
                  tasks.id:
                    type: string
                    description: >-
                      我们系统中的*唯一任务标识符*，采用[通用唯一标识符
                      (UUID)](https://en.wikipedia.org/wiki/Universally_unique_identifier)
                      格式
                  tasks.status_code:
                    type: integer
                    description: DataForSEO 生成的*任务状态码*；取值范围为：10000-60000
                  tasks.status_message:
                    type: string
                    description: '*任务信息消息*'
                  tasks.time:
                    type: string
                    description: '*执行时间（秒）*'
                  tasks.cost:
                    type: number
                    description: '*任务成本（美元）*'
                  tasks.result_count:
                    type: integer
                    description: '*`result` 数组中的元素数量*'
                  tasks.path:
                    type: array
                    items:
                      type: string
                    description: '*URL 路径*'
                  tasks.data:
                    type: object
                    description: '*包含与您在 POST 请求中指定的参数相同的参数*'
                  result:
                    type: array
                    items:
                      type: string
                    description: '*结果数组*；在这种情况下，该值将为 `null`'
        '400':
          description: 错误请求
        '401':
          description: 未授权
        '429':
          description: 超出速率限制
        '500':
          description: 内部服务器错误
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````