本節提供以 Google XML 為基礎的 Hint 要求訊息、提示回應訊息和查詢訊息參考資料。
<Hint>
(提示回應訊息)
Hint 回應訊息的根元素。提示回應訊息會指定哪些飯店/行程組合應重新定價。這些是您對 Google 的提示要求訊息的回應。
提示回應訊息應僅指定 Google 從您伺服器上次收到成功提示回應後,價格已變更的飯店。
Hint Response 訊息會使用下列其中一種方法,指定 Google 應重新計算價格的飯店和行程:
確切的行程:入住日期和入住天數的組合。
入住日期範圍:指定入住日期範圍,從第一次入住日期開始,並且從上次入住日期結束。
範圍住宿 (或特定範圍的行程)
這兩種方法都需要針對提示回應訊息使用不同的語法。
詳情請參閱提示回應訊息。
語法
<Hint>
元素會根據提示回應訊息的類型使用不同的語法:
確切的行程
以下是提示回應訊息中精確行程的語法:
<!-- Exact Itinerary Hint Response -->
<?xml version="1.0" encoding="UTF-8"?>
<Hint>
<Item>
<Property>hotel_ID</Property>
...
<Stay>
<CheckInDate>checkin_date</CheckInDate>
<LengthOfStay>number_of_nights</LengthOfStay>
</Stay>
</Item>
...
</Hint>
入住範圍
以下是提示回應訊息中檢查範圍的語法:
<!-- Check-in Ranges Hint Response -->
<?xml version="1.0" encoding="UTF-8"?>
<Hint>
<Item>
<!-- At least one is required -->
<!-- Can be > 1 if MultipleItineraries is "checkin_range" in your
QueryControl message -->
<Property>hotel_ID</Property>
[...]
<!-- Required -->
<FirstDate>first_checkin_date</FirstDate>
<!-- Required -->
<LastDate>last_checkin_date</LastDate>
</Item>
...
</Hint>
範圍住宿
以下是提示回應訊息中範圍保留功能的語法:
<!-- Ranged Stay Hint Response -->
<?xml version="1.0" encoding="UTF-8"?>
<Hint>
<Item>
<!-- At least one is required -->
<!-- Can be > 1 if MultipleItineraries is "affected_dates" in your
QueryControl message -->
<Property>hotel_ID</Property>
[...]
<StaysIncludingRange>
<!-- Required -->
<FirstDate>first_date</FirstDate>
<!-- Optional -->
<LastDate>last_date</LastDate>
</StaysIncludingRange>
</Item>
...
</Hint>
屬性
<Hint>
元素包含選用屬性:id
。如有提供,就會以這個 <Hint>
傳送的 <Query>
訊息的形式納入 hintId
屬性。
子元素
<Hint>
元素包含下列子元素:
子項元素 | 必填與否 | 類型 | 提示回應類型 | 說明 |
---|---|---|---|---|
<CheckInDate> | Required | Date | 確切的行程 | 行程入住日期。 |
<FirstDate> | Required | Date | 入住範圍和範圍行程 | 入住範圍或指定日期範圍內,保持提示回應訊息的日期範圍的第一個日期。日期內含。 |
<Item> | Required | Object | 全部 | 要更新的飯店/行程容器。 |
<LastDate> | Required* | Date | 入住範圍和範圍行程 | 入住範圍或指定日期範圍內,保持提示回應訊息的日期範圍的最後一個日期。日期內含。 * 此元素是範圍入住的選用元素。 |
<LengthOfStay> | Required | integer | 確切行程 | 行程住宿晚數,以正整數表示。 |
<Property> | Required | string | 全部 | 飯店的 ID,使用與飯店清單相同的 ID。單一
|
<Stay> | Required | Object | 確切的行程 | 確切行程提示訊息中 <CheckinDate> 和 <LengthOfStay> 元素的容器。每個 <Item> 只能包含一個 <Stay> 。 |
<StaysIncludingRange> | Required | Object | 特定範圍行程 | 範圍保留提示訊息中 <FirstDate> 和 <LastDate> 元素的容器。 |
示例
確切的行程
以下範例針對提示回應訊息的單一屬性定義多個行程:
<!-- Exact Itinerary Hint Response -->
<?xml version="1.0" encoding="UTF-8"?>
<Hint>
<Item>
<Property>12345</Property>
<Stay>
<CheckInDate>2018-07-03</CheckInDate>
<LengthOfStay>3</LengthOfStay>
</Stay>
</Item>
<Item>
<Property>12345</Property>
<Stay>
<CheckInDate>2018-07-03</CheckInDate>
<LengthOfStay>4</LengthOfStay>
</Stay>
</Item>
</Hint>
入住範圍
以下範例指定兩間定價已變更且應再次擷取的飯店。Google 會從 7 月 3 日到 7 月 6 日之間,針對 12345 與 67890 屬性取得所有行程:
<!-- Check-in Ranges Hint Response -->
<?xml version="1.0" encoding="UTF-8"?>
<Hint>
<Item>
<Property>12345</Property>
<Property>67890</Property>
<FirstDate>2018-07-03</FirstDate>
<LastDate>2018-07-06</LastDate>
</Item>
</Hint>
請注意,如要在單一 <Item>
中指定多個屬性的入住範圍訊息,則 <QueryControl>
中的 <MultipleItineraries>
值必須設為 "checkin_range"
。
範圍住宿
以下範例顯示兩種範圍住宿的不同用途,一種用於兩個夜晚,另一種用於一天晚上:
<!-- Ranged Stay Hint Response -->
<?xml version="1.0" encoding="UTF-8"?>
<Hint>
<!-- Google fetches prices for all itineraries (first and last date are set) -->
<Item>
<Property>12345</Property>
<StaysIncludingRange>
<FirstDate>2018-07-03</FirstDate>
<LastDate>2018-07-06</LastDate>
</StaysIncludingRange>
</Item>
<!-- Google fetches prices for a single night (first date only) -->
<Item>
<Property>67890</Property>
<StaysIncludingRange>
<FirstDate>2018-07-03</FirstDate>
</StaysIncludingRange>
</Item>
</Hint>
請注意,如要在單一 <Item>
中指定多個範圍的住宿訊息,則 <QueryControl>
中的 <MultipleItineraries>
值必須設為 "affected_dates"
。
針對每個範例,Google 都會使用 <Query>
回應,並透過 <Transaction>
回應,其中包含指定飯店/行程的最新價格資訊。
<HintRequest>
Hint 要求訊息的根元素。Google 會將提示要求訊息傳送至您的伺服器,並預期回應中指出哪些飯店和行程價格自 Google 上次收到伺服器傳送成功的提示回應後,價格已變更。
如果價格有任何異動,Google 會傳送 <Query>
,用於擷取指定飯店和行程的更新價格資料。
詳情請參閱提示要求訊息。
語法
<HintRequest>
元素使用下列語法:
語法
<?xml version="1.0" encoding="UTF-8"?>
<HintRequest>
<LastFetchTime>last_fetch_time</LastFetchTime>
</HintRequest>
屬性
<HintRequest>
元素沒有屬性。
子元素
<HintRequest>
元素包含下列子元素:
子項元素 | 類型 | 說明 |
---|---|---|
<LastFetchTime> | DateTime | 上次 Google 成功在提示要求訊息收到提示回應訊息的時間。
如果這個時間早於您上次更新伺服器價格的時間,則應回應「提示回應」訊息,指出哪些飯店已變更。 如果最近未成功擷取,這個項目會設為固定的間隔值,以免發生大型待處理作業的嚴重問題。目前的固定間隔值為 1000 秒,但可能會有所變動。 詳情請參閱提示回應訊息。 |
示例
以下範例顯示提示要求訊息:
提示要求訊息
以下範例顯示 Hint 要求訊息:
<?xml version="1.0" encoding="UTF-8"?>
<HintRequest id="ABCDEF" timestamp="2018-06-07T16:20:00Z">
<LastFetchTime>2018-03-25T00:04:09Z</LastFetchTime>
</HintRequest>
<Query>
Query
訊息的根元素。Query
訊息是 Google 提出的價格或中繼資料更新要求。兩者搭配「提取」和「價格變更」提供模式使用。
Query
訊息有三種類型:
即時價格:Google 會回應特定使用者要求,要求即時更新價格。合作夥伴收到
Live pricing query
訊息時,應以<Transaction>
訊息回應,其中含有<Result>
元素中要求的價格資訊。採用結構定義定價:Google 會根據過去最熱門的情境,更新價格快取。收到
With context query
訊息時,您應該以<Transaction>
訊息回應,其中包含<Result>
元素中要求的定價資訊。中繼資料:Google 會要求更新指定飯店的會議室和 Room Bundle 的中繼資料。收到
Metadata Query
訊息時,您應該以<Transaction>
訊息回應,指出<PropertyDataSet>
元素中的會議室和 Room Bundle 相關資料。
詳情請參閱定價查詢的定價總覽;有關中繼資料查詢,請參閱 Room Bundle 中繼資料。
以下說明三種不同類型的語法。
語法
<Query>
元素使用下列語法:
即時價格
<?xml version="1.0" encoding="UTF-8"?>
<Query latencySensitive="true_or_false">
<Checkin>YYYY-MM-DD</Checkin>
<Nights>number_of_nights</Nights>
<!-- Only for Check-in Date Range pricing queries (Changed Pricing) -->
<FirstDate>YYYY-MM-DD</FirstDate>
<LastDate>YYYY-MM-DD</LastDate>
<!-- Only for Ranged Stay pricing queries (Changed Pricing) -->
<AffectedNights>number_of_nights</AffectedNights>
<PropertyList>
<Property>hotel_id</Property>
...
</PropertyList>
<!-- See documentation below for <Context> -->
<Context>
...
</Context>
</Query>
包含情境
<?xml version="1.0" encoding="UTF-8"?>
<Query>
<Checkin>YYYY-MM-DD</Checkin>
<Nights>number_of_nights</Nights>
<!-- Only for Check-in Date Range pricing queries (Changed Pricing) -->
<FirstDate>YYYY-MM-DD</FirstDate>
<LastDate>YYYY-MM-DD</LastDate>
<!-- Only for Ranged Stay pricing queries (Changed Pricing) -->
<AffectedNights>number_of_nights</AffectedNights>
<PropertyContextList>
<PropertyContext>
<Property>hotel_id</Property>
...
<!-- See documentation below for <Context> -->
<Context>
...
</Context>
</PropertyContext>
</PropertyContextList>
</Query>
中繼資料
<HotelInfoProperties>
<Property>property_ID</Property>
...
</HotelInfoProperties>
屬性
<Query>
元素可能包含一個屬性:latencySensitive
。
latencySensitive
為選用屬性,如果提供且設為 true
,則表示查詢為 Live Pricing Query
。如要讓 Google 傳送含有 latencySensitive
屬性的查詢,請洽詢您的客戶技術顧問 (TAM)。
子元素
<Query>
元素包含下列子元素:
子項元素 | 查詢類型 | 類型 | 說明 |
---|---|---|---|
<AffectedNights> | Pricing | integer | 特定日期範圍的住宿晚數。這個元素僅適用於搭配「價格變更」功能使用的 Ranged Stay 定價查詢。 |
<Checkin> | Pricing | Date | 特定價格異動的日期。 |
<Context> | Pricing (Live Pricing Queries only) | <Context> | 為即時價格查詢,指定查詢的特定參數。子元素包括:
|
<FirstDate> | Pricing | Date | 適用價格範圍的行程開始日期。這個元素僅適用於入住日期範圍價格查詢,且僅適用於「價格變更」查詢。 |
<HotelInfoProperties> | Metadata | string | Google 希望在中繼資料 Query 訊息中更新會議室和 Room Bundle 中繼資料的一或多項屬性。這個元素可包含一或多個指定飯店房源 ID 的 <Property> 元素。 |
<LastDate> | Pricing | Date | 價格適用特定行程的結束日期。這個元素僅適用於入住日期範圍定價查詢,且搭配「提取 + 提示」功能使用。 |
<Nights> | Pricing | integer | 特定行程的住宿晚數,最多 30 個。 |
<PropertyList> | Pricing | Object | 需要更新價格的飯店的一或多個 ID。 在 <PropertyList> <Property>pid1</Property> <Property>pid2</Property> </PropertyList> |
示例
定價查詢
以下範例顯示「定價查詢」訊息,該訊息要求一組從 2018 年 6 月 10 日開始,持續 3 晚的飯店價格更新資訊:
<?xml version="1.0" encoding="UTF-8"?>
<Query>
<Checkin>2023-05-23</Checkin>
<Nights>3</Nights>
<PropertyList>
<Property>pid5</Property>
<Property>pid8</Property>
<Property>pid13</Property>
<Property>pid21</Property>
</PropertyList>
</Query>
即時價格查詢
以下範例顯示回應時間限制為 500 毫秒的即時價格查詢:
<?xml version="1.0" encoding="UTF-8"?>
<Query latencySensitive="true">
<Checkin>2017-06-07</Checkin>
<Nights>5</Nights>
<DeadlineMs>500</DeadlineMs>
<PropertyList>
<Property>8675309</Property>
</PropertyList>
<Context>
<Occupancy>4</Occupancy>
<OccupancyDetails>
<NumAdults>2</NumAdults>
<Children>
<Child age="8"/>
<Child age="5"/>
</Children>
</OccupancyDetails>
<UserCountry>US</UserCountry>
<UserDevice>mobile</UserDevice>
</Context>
</Query>
使用情境查詢
<?xml version="1.0" encoding="UTF-8"?>
<Query>
<Checkin>2023-05-23</Checkin>
<Nights>2</Nights>
<PropertyContextList>
<PropertyContext>
<Property>8675309</Property>
<!-- In the future, occupancy and device might be specified -->
<Context><UserCountry>US</UserCountry></Context>
<Context><UserCountry>GB</UserCountry></Context>
</PropertyContext>
<PropertyContext>
<Property>8675310</Property>
<Property>8675311</Property>
<Context><UserCountry>CA</UserCountry></Context>
</PropertyContext>
</PropertyContextList>
</Query>
中繼資料查詢
<?xml version="1.0" encoding="UTF-8"?>
<Query>
<HotelInfoProperties>
<Property>pid5</Property>
<Property>pid8</Property>
<Property>pid13</Property>
<Property>pid21</Property>
</HotelInfoProperties>
</Query>
如需更多範例,包括範圍入住和入住日期範圍價格查詢,請參閱 Query
訊息範例。
<Context>
<Context>
元素會說明 Live pricing query
的資訊,包括房客的人數與類型、使用者國家/地區和使用者裝置。
多個 <Context>
永遠無法與不同的使用者國家/地區或使用者裝置搭配使用。如果使用多個 <Context>
查詢多個可住人數,請提供每個入住人數,做為對應房源/行程的額外房型套裝組合。每個房源/行程都應有一個 <Result>
區塊,內含多種可住人數的價格。
如需 <Context>
查詢的回應詳細資料,請參閱 <OccupancyDetails>
。
語法
<Context>
元素使用下列語法:
語法
<?xml version="1.0" encoding="UTF-8"?>
<Query latencySensitive="true_or_false">
<Checkin>date</Checkin>
<Nights>number_of_nights</Nights>
<DeadlineMs>number_of_milliseconds</DeadlineMs>
<PropertyList>
<Property>property_ID</Property>
</PropertyList>
<Context>
<Occupancy>total_number_of_guests</Occupancy>
<OccupancyDetails>
<NumAdults>number_of_adults</NumAdults>
<Children>
<Child age=age_of_one_child_guest/>
<Child age=age_of_one_child_guest/>
</Children>
</OccupancyDetails>
<UserCountry>end_user_country</UserCountry>
<UserDevice>user_device_type</UserDevice>
</Context>
</Query>
子元素
<Context>
元素包含下列子元素:
子項元素 | 查詢類型 | 類型 | 說明 |
---|---|---|---|
<Occupancy> | Pricing | integer | 指定房客總數。 雖然非強制性,但使用 注意事項: |
<OccupancyDetails> | Pricing | Object | 前方加上 <Occupancy> 。依類型指定邀請對象,包括:
雖然非強制性,但使用 注意: |
<UserCountry> | Pricing | string | 依使用者所在國家/地區篩選費率。這個值是雙字母的國家/地區代碼 (例如 定義 |
<UserDevice> | Pricing | string | 依使用者搜尋的裝置類型篩選費率。可能的類型包括:
以 |
示例
人員偵測狀態
以下範例顯示 <Context>
中 <Occupancy>
的即時價格查詢。即時價格查詢適用於 3 位成人訪客。
<?xml version="1.0" encoding="UTF-8"?>
<Query latencySensitive="true">
<Checkin>2017-06-07</Checkin>
<Nights>4</Nights>
<DeadlineMs>500</DeadlineMs>
<PropertyList>
<Property>45617</Property>
</PropertyList>
<Context>
<Occupancy>3</Occupancy>
<UserCountry>US</UserCountry>
<UserDevice>mobile</UserDevice>
</Context>
</Query>
可住人數詳細資料
以下範例顯示在 <Context>
內使用 <OccupancyDetails>
的即時價格查詢。即時價格查詢適用於 4 位房客 (其中 2 名兒童),此查詢會尋找適用於透過行動裝置訪客預訂的美國旅客費率:
<?xml version="1.0" encoding="UTF-8"?>
<Query latencySensitive="true">
<Checkin>2017-06-07</Checkin>
<Nights>5</Nights>
<DeadlineMs>500</DeadlineMs>
<PropertyList>
<Property>8675309</Property>
</PropertyList>
<Context>
<Occupancy>4</Occupancy>
<OccupancyDetails>
<NumAdults>2</NumAdults>
<Children>
<Child age="4"/>
<Child age="12"/>
</Children>
</OccupancyDetails>
<UserCountry>US</UserCountry>
<UserDevice>mobile</UserDevice>
</Context>
</Query>
多個情境
以下範例顯示如何在即時價格查詢中使用其他 <Context>
元素。
<?xml version="1.0" encoding="UTF-8"?>
<Query latencySensitive="true">
<Checkin>2017-06-07</Checkin>
<Nights>4</Nights>
<DeadlineMs>500</DeadlineMs>
<PropertyList>
<Property>45617</Property>
</PropertyList>
<Context>
<Occupancy>3</Occupancy>
<UserCountry>US</UserCountry>
<UserDevice>mobile</UserDevice>
</Context>
<Context>
<Occupancy>6</Occupancy>
<OccupancyDetails>
<NumAdults>4</NumAdults>
<Children>
<Child age="6"/>
<Child age="10"/>
</Children>
</OccupancyDetails>
<UserCountry>US</UserCountry>
<UserDevice>mobile</UserDevice>
</Context>
</Query>