搜尋和過濾
輕鬆搜尋和過濾快速內容 API 回應以獲得更有針對性的結果。
您可以使用 Rapid Content API 的搜尋和篩選功能來控制在回應中接收的屬性資訊。這使您可以簡化接收的資料並僅存取旅行者需要的信息,從而降低成本並提高靈活性。
搜尋
使用搜尋功能尋找為客人提供特定便利設施或服務的飯店,例如,提供增強永續性功能的飯店。
您可以透過 property-level 元素進行搜索,包括:
category_id
: 類別all_inclusive
:All-inclusive 狀態attribute_id
:屬性amenity_id
:物業級設施spoken_language_id
: 口語
備註:此功能不包括特定的客房或房價計畫元素。
請求範例 1
在此範例中,我們使用新的 amenity_id
搜尋參數來限制傳回的屬性。
curl -X GET "https://test.ean.com/v3/properties/content\
?language=en-US\
&supply_source=expedia\
&amenity_id=115\
&include=property_id\
&property_id=1337\
&property_id=1" \
-H "accept: application/json, application/json"\
-H "accept-encoding: gzip"\
-H "authorization: EAN apikey=abcd1234,signature=090a77e7ddd7779980231,timestamp=1697664047"\
-H "user-agent: TravelNow/3.30.112"
回應範例 1
在此回應中,我們可以看到僅傳回了屬性 1337,因為屬性 1 沒有可用的便利設施 ID 115 。
{
"1337": {
"property_id": "1337"
}
}
有關可用屬性、設施、口語和類別的完整列表,請參閱內容參考列表。
篩選
您可以僅請求所需的 top-level 部分,而不接收完整的屬性詳細資訊。使用 include
參數指定您想要的部分。結果將由 property_id
和每個屬性所請求的部分組成。
可供過濾的部分
注意:此清單不應被視為詳盡無遺的,因為過濾功能也將適用於將來新增的任何新的 top-level 部分。
property_id
name
address
ratings
location
phone
fax
category
rank
business_model
checkin
checkout
fees
policies
attributes
amenities
images
onsite_payments
rooms
rates
dates
descriptions
statistics
airports
themes
all_inclusive
tax_id
chain
brand
spoken_languages
multi_unit
payment_registration_recommended
supply_source
vacation_rental_details
請求範例 2
在此範例中,我們在 name
參數中使用 amenities
和 include
值。
curl -X GET "https://test.ean.com/v3/properties/content\
?language=en-US\
&supply_source=expedia\
&include=name\
&include=amenities\
&property_id=1337" \
-H "accept: application/json, application/json"\
-H "accept-encoding: gzip"\
-H "authorization: EAN apikey=abcd1234,signature=090a77e7ddd7779980231,timestamp=1697664047"\
-H "user-agent: TravelNow/3.30.112"
回應範例 2
此範例顯示回應中包含 property_id
、name
和 amenities
。注意:property_id
始終包含在回應中;您不需要將其指定為 include
參數,除非它是您想要的唯一欄位。
{
"1337": {
"property_id": "1337",
"name": "Hyatt Regency Paris Etoile",
"amenities": {
"8": {
"id": "8",
"name": "Elevator"
},
"43": {
"id": "43",
"name": "Concierge services"
},
"115": {
"id": "115",
"name": "Bicycle rentals nearby"
},
"361": {
"id": "361",
"name": "Breakfast available (surcharge)"
},
...
}
}
}