Travel Partner Prices API
Travel Partner Prices API 可为您提供一个 RESTful 接口,用于向 Google 发送房源价格。
服务:travelpartnerprices.googleapis.com
如要调用此服务,我们建议您使用 Google 提供的客户端库。如果您的应用需要使用您自己的库来调用此服务,请与您的技术支持客户经理 (TAM) 联系,以获取此服务的 Discovery 文档。
服务端点
服务端点是一个基础网址,指定了 API 服务的网络地址。一项服务可能有多个服务端点。此服务具有以下服务端点,列出的所有 URI 都与此服务端点相关:
https://travelpartnerprices.googleapis.com
| 方法 | |
|---|---|
ingestLosPropertyPrices |
POST /v1/accounts/account_id/properties/property_id:ingestLosPropertyPrices
上传指定房源的住宿晚数价格。 需要将 JSON 编码的 LoS 价格消息(见下文)作为 HTTP 消息正文。
|
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”替换为“Travel Partner Prices 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 小时内发送的任何带有 消息会按 RFC 3339 要求完全指定日期时间,格式为 秒的小数部分是可选的,可以精确到纳秒。例如, |
| propertyPrices | 1 | Object | 房源的价格。此 propertyPrices 中的所有价格均适用于同一房源。
此元素不会重复。如需为多项房源发送价格,您需要发出多个 HTTP 请求(每项房源至少一个)。 |
| arrivalDayPrices[] | 1..n | Object | 到达日期的价格。此 arrivalDayPrices 中的所有价格均适用于特定房源,但入住日期不同。 |
| startDate | 1 | Object | productPrices 适用于 startDate 到 endDate(含)之间的所有到达日期。
如果只想指定一个到达日期(而不是一个范围),请在 |
| startDate.year | 1 | integer | startDate 的年份。必须介于 1 到 9999 之间。 |
| startDate.month | 1 | integer | 一年中的第几个月。必须是 1 和 12 之间的数字。 |
| startDate.day | 1 | integer | 一个月中的第几天。必须介于 1 到 31 之间并且对年份和月份有效。 |
| endDate | 0..1 | Object | productPrices 适用于 startDate 和 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 之间的正整数。
注意:如需发送超过 4 位成人的入住人数,请与支持团队联系。 |
| prices[] | 1..n | Object | 住宿晚数价格。prices 中的所有价格均适用于特定的房源、入住日期、产品和入住人数组合。
|
| rateRuleId | 0..1 | string | 对于条件式费率,此 ID 可将费率与费率规则定义文件中的定义相匹配。 此字段的字符数上限为 40 个字符。 |
| currencyCode | 1 | string | 提供 rates 和 taxes 时所用的三字母币种代码。例如,"USD" 表示美元。
|
| rates[] | 30 | float | 住宿时长的价格的基本费率组成部分。
如果提供了相应的 索引 您必须一次性发送完整的 30 个价格的 LoS 集。如果您发送的 LoS 价格少于 30 个,系统会正常处理所有提供的 LoS 价格,而剩余的费率(最多到 LoS 30)将不可用。如果您发送的费率超过 30 个,则超出第 30 个费率的任何价格都会被舍弃。 无法预订的住宿时长应以 |
| taxes[] | 30 | float | 住宿晚数价格的税费组成部分。
索引 |
| fees[] | 30 | float | 住宿晚数价格的费用组成部分。
索引 |
示例
基于 LOS 的价格和税费
以下示例展示了如何为一个入住日期设置 2 晚的最短住宿晚数,并为另一个入住日期设置无空房。
如果您将 startDate 设置为 2023 年 9 月 1 日,但不设置 endDate,则表示您仅指定了一个日期的费率,因此可以省略 endDate。
设置为 2 的 occupancyPrices 数组可让您为不同的入住率设置不同的房价。因此,2023 年 9 月 4 日没有空缺会限制可用的 rates。
显示的 taxes 数组是按费率的 10% 计算的。
显示的 fees 数组表示每次住宿收取 50 美元的清洁费。
如果整个入住日期(即 2023 年 9 月 3 日)都不可预订,您必须明确发送该日期,并省略 rates、taxes 和 productPrices,以表明所请求的日期没有可预订的房源。
{
"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}。
|