住宿晚数 (LoS) 价格

Travel Partner Prices API

Travel Partner Prices API 为您提供了一个 RESTful 接口,用于向 Google 发送房源价格。

服务:travelpartnerprices.googleapis.com

要调用此服务,我们建议您使用 Google 提供的客户端 库。如果您的 应用需要使用您自己的库来调用此服务,请联系您的 负责获取发现文档的技术支持客户经理 (TAM) 。

服务端点

服务端点是一个基础网址,指定了 API 服务的网络地址。一项服务 可能有多个服务端点此服务具有以下服务 端点和列出的所有 URI 均相对于此服务端点:

https://travelpartnerprices.googleapis.com
方法
ingestLosPropertyPrices POST /v1/accounts/account_id/properties/property_id:ingestLosPropertyPrices

上传为指定房源提供的住宿晚数价格。

需要将 JSON 编码的 LoS 价格消息(见下文)作为 HTTP 消息正文。

account_id:此字符串值是 Hotel Center 的“账号设置”页面上列出的“账号 ID”值。

property_id:此元素的值必须 是一个与您的酒店列表 Feed 中的房源 ID 匹配的字符串。

API 身份验证

Travel Partner Prices API 使用 OAuth 2.0 来 对应用进行身份验证,以便您可以访问 API。

按照 OAUTH 2.0 设置操作 说明获取 Travel Partner Prices API 的授权。

为 Travel Partners Prices API 创建新项目时,您需要执行以下操作: 启用对新 Google Cloud 控制台项目的访问权限,该项目类似于 Travel Partner API 中提供的说明。

请参阅 Travel Partner API 中提供的步骤 并将“Travel Partner API”的所有实例显示“旅行合作伙伴价格” API”以启用您的项目

Travel Partner Prices API 的范围如下: "https://travelpartnerprices.googleapis.com"

Travel Partner Prices API 的上传路径为: "/travel/lodging/uploads/accounts/<account_id>/property_data"

请求

语法

LoS Prices 消息使用以下语法:

{
 
"requestTime": YYYY-MM-DDTHH:mm:ss.SSSZ,
 
"propertyPrices": {
   
"arrivalDatePrices": [{
     
"startDate": {
       
"year": int
       
"month": int
       
"day": int
     
}
     
"endDate": {
       
"year": int
       
"month": int
       
"day": int
     
}
     
"productPrices": [{
       
"roomTypeId": "string"
       
"ratePlanId": "string"
       
"occupancyPrices": [{
         
"adults": int
         
"prices": [{
           
"rateRuleId": "string"
           
"currencyCode": "string"
           
"rates": [night_1,night_2,...]
           
"taxes": [night_1,night_2,...]
           
"fees": [night_1,night_2,...]
         
}]
       
}]
     
}]
   
}]
 
}
}

元素和属性

住宿晚数价格消息包含以下元素和属性:

元素 出现次数 类型 说明
requestTime 1 string

LoS 价格消息发送的时刻,表示 RFC 3339 格式 字符串。

过去 24 天内使用 requestTime 发送的任何消息 小时数会被处理,未舍弃的小时数会被舍弃。

系统会按照“requestTime”的顺序处理消息, 而不论其接收顺序如何。例如, 价格更新,requestTime 收到 2019-05-03T14:09:00Z 时, 返回 requestTime2019-05-03T14:10:00Z 均被舍弃,取而代之的是 带时间戳的消息。

RFC 3339 要求完全指定日期时间,如 YYYY-MM-DDThh:mm:ss.SSZ。时区是必需的,可以指定为与世界协调时间 (UTC) 的正或负 hh:mm 偏移量,也可以指定为 Z(作为世界协调时间的缩写)。

小数秒是可选项,最多可表示为 精确到纳秒。例如,2017-01-15T01:30:15.01-08:00 会将 2017 年 1 月 15 日 01:30(太平洋标准时间)之后的 15.01 秒编码为 15.01。

propertyPrices 1 Object 房源的价格。此propertyPrices内的所有价格 会应用于同一个媒体资源。

此元素不会重复。如需发送多项房源的价格,您需要发出多个 HTTP 请求(每个房源至少一个)。

arrivalDayPrices[] 1..n Object 到达日期的价格。此 arrivalDayPrices 中的所有价格都适用于同一房源,但抵达日期不同。
startDate 1 Object productPrices适用于所有抵达日期 介于 startDateendDate 之间(包括这两个数值)。

如果只是尝试指定一个到达日期(而不是一个范围), 将到达日期同时输入到 startDateendDate

startDate.year 1 integer startDate 的年份。必须是 1 到 9999 之间的数字。
startDate.month 1 integer 一年中的第几个月。必须是 1 和 12 之间的数字。
startDate.day 1 integer 一个月中的第几天。必须介于 1 到 31 之间,并且对年份和月份有效。
endDate 0..1 Object productPrices 会应用于 startDateendDate(含边界值)。

如果只是尝试指定一个到达日期(而不是一个范围), endDate 可以省略。

endDate.year 1 integer endDate 的年份。必须是 1 到 9999 之间的数字。
endDate.month 1 integer 一年中的第几个月。必须是 1 和 12 之间的数字。
endDate.day 1 integer 一个月中的第几天。必须介于 1 到 31 之间,并且对年份和月份有效。
productPrices[] 1..n Object 商品的价格。此productPrices内的所有价格 适用于特定房源、到达日期组合,但不同于 产品。
roomTypeId 0..1 string 此价格所代表的房间的唯一 ID。使用此 ID 将 Room Bundle 数据与您在 roomdata 中发送的数据进行匹配。如需了解详情,请参阅房间软件包元数据
ratePlanId 0..1 string 此价格所引用的套餐数据的唯一 ID。使用此 ID 将 Room Bundle 数据与您在 packagedata 中发送的数据进行匹配。如需了解详情,请参阅 客房套餐元数据
occupancyPrices[] 1..n Object 入住人数价格。此occupancyPrices内的所有价格 适用于特定房源、到达日期、商品组合,但应用于 不同入住人数。
adults 1 integer 每间客房最多可入住的客人数量(包括成人和儿童)。该值是为 相应的 occupancyPrices 字段,且必须为正数 介于 1 到 99 之间的整数。

注意:请联系您的支持团队,发送 超过四位成人出现。

prices[] 1..n Object 住宿晚数价格。prices内的所有价格均适用于 特定房源、到达日期、产品和入住人数组合。
rateRuleId 0..1 string 对于条件式费率,此 ID 用于将费率与费率规则定义文件中的定义进行匹配。 此字段的字符数限制为 40 个字符。
currencyCode 1 string ratestaxes 采用的三字母货币代码。例如,"USD" 表示美元。
rates[] 30 float 住宿晚数价格中的基本费率组件。

如果提供了相应的 taxes 值,则此费率不含税费。总价是相关商品的价格 税率和税费。

索引 n 处的值对应于 n+1 住宿晚数。

您必须一次性发送包含 30 个价格的完整 LoS 集。如果您发送的数量少于 30 个,系统会照常处理所提供的所有 LoS 价格,并且剩余的费率将不适用于 LoS 30。如果您发送的费率超过 30 个,系统会舍弃您发送的第 31 个费率及之后的所有费率。

不可用的住宿晚数应以 0

taxes[] 30 float 住宿晚数价格的税费部分。

索引 n 处的值对应于 n+1 住宿晚数。

fees[] 30 float 住宿晚数价格的费用组成部分。

索引 n 处的值对应于 n+1 住宿晚数。

示例

以下示例展示了如何将最短住宿晚数设置为 2 一个入住日期且没有为另一个入住日期设置空房情况。 如果您在 2023 年 9 月 1 日设置的 startDate 没有 endDate,则意味着 但要仅针对一个日期指定费率,则可以省略 endDate

通过将 occupancyPrices 数组设置为 2,您可以为不同的入住人数设置不同的房价。因此,2023 年 9 月 4 日这一天上限中没有空位信息 可用的rates

显示的 taxes 数组按 10% 的比率计算得出。

所示 fees 数组对每住宿一次收取 50 美元的清洁费。

如果无法提供整个入住日期(2023 年 9 月 3 日),您必须 并明确发送日期,并省略 ratestaxesproductPrices,以 表示所请求的日期没有空房。

{
 
"requestTime": "2023-08-10T12:15:222",
 
"propertyPrices": {
   
"arrivalDatePrices": [
     
{
       
"startDate": {
         
"year": 2023,
         
"month": 9,
         
"day": 1
       
},
       
"productPrices": [
         
{
           
"occupancyPrices": [
             
{
               
"adults": 2,
               
"prices": [
                 
{
                   
"currencyCode": "USD",
                   
"rates": [
                     
0, 200, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                   
],
                   
"taxes": [
                     
0, 20, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                   
],
                   
"fees": [
                     
0, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                   
]
                 
}
               
]
             
}
           
]
         
}
       
]
     
},
     
{
       
"startDate": {
         
"year": 2023,
         
"month": 9,
         
"day": 3
       
},
       
"productPrices": [
         
{
           
"occupancyPrices": [
             
{
               
"adults": 2,
               
"prices": [
                 
{
                   
"currencyCode": "USD",
                   
"rates": [
                     
0, 200, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                   
],
                   
"taxes": [
                     
0, 20, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                   
],
                   
"fees": [
                     
0, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                     
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
                   
]
                 
}
               
]
             
}
           
]
         
}
       
]
     
}
   
]
 
}
}

响应正文

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
        {
         
"name": "string"
       
}
       
字段
name 修改后的 PropertyPrices 的资源名称。采用以下形式:
accounts/{account}/properties/{property}