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 訊息主體。
|
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 之間的正整數。注意:如要傳送四位以上成人的入住人數,請與支援團隊聯絡。 |
| prices[] | 1..n | Object | 住宿天數價格。prices 中的所有價格都適用於特定房源、抵達日期、產品和入住人數組合。 |
| rateRuleId | 0..1 | string | 如果是條件式費率,這個 ID 會將費率與費率規範定義檔案中的定義相符。這個欄位的字元長度上限為 40 個半形字元。 |
| currencyCode | 1 | string | rates 和 taxes 提供的貨幣代碼 (由三個字母組成)。例如,美元的符號為 "USD"。
|
| rates[] | 30 | float | 住宿天數價格的基本費率部分。
如果提供對應的 索引 你必須一次傳送完整的 30 個價格 LoS 組合。如果傳送的價格少於 30 個,系統會正常處理所有提供的 LoS 價格,其餘費率則會無法使用,最多到 LoS 30。如果傳送超過 30 個費率,系統會捨棄第 30 個費率之後的任何費率。 無法入住的天數應以 |
| taxes[] | 30 | float | 入住天數價格的稅額部分。
索引 |
| fees[] | 30 | float | 入住天數價格的費用部分。
索引 |
範例
根據入住天數計算的房價和稅金
以下範例說明如何為一個入住日期設定最短入住天數為 2,並為另一個入住日期設定無空房。
如果設定 2023 年 9 月 1 日的 startDate,但沒有 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}。
|