概述

本指南介绍 SOAP 和 REST 版本的 EAN API 之间的重要区别。使用本指南有助于将集成更新为 REST 以及验证您的更改。本指南中仅介绍基本预订路径(列表、可订空房、预订)。

全局更改
##全局更改 ###通用元素 API 的[通用请求元素][1]对于身份验证、佣金、统计信息和定价至关重要。忽略任何必需的通用元素都可能导致定价不匹配、预订失败或其他错误。本指南中用黄色突出显示了这些元素。 对于 SOAP,通用元素包含在请求正文中。在更新到 REST 时,这些元素作为 URL 参数发送。 默认情况下不会返回 JSON 回复。要请求 JSON 格式的回复,您必须在 HTML 请求标题中包含“Accept:application/json”。如果不包含正确的 Accept 标题值,则对 REST 请求的回复将默认为 XML。

在测试期间,无需更改请求标题,您可以在请求正文中包含参数“_type=json”。以下示例中突出显示了该参数,以指明回复不默认为 JSON。请勿在生产请求中使用该参数。 [1]: /docs/common/
SOAP 通用元素
<soapenv:Body>
<v3:{serviceName}>
<{requestParentElement}>
<apiKey>#####</apiKey>
<cid>######</cid>
<customerIpAddress>##########</customerIpAddress> <customerUserAgent>##########</customerUserAgent> <customerSessionId>##########</customerSessionId>
<minorRev>##</minorRev> <locale>en_US</locale> <currencyCode>USD</currencyCode> ...
REST 通用元素
http://api.ean.com/ean-services/rs/hotel/v3/{serviceName}?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&_type=json
...


SOAP 通用元素
<soapenv:Body>
<v3:{serviceName}>
<{requestParentElement}>
<apiKey>#####</apiKey>
<cid>######</cid>
<customerIpAddress>##########</customerIpAddress> <customerUserAgent>##########</customerUserAgent> <customerSessionId>##########</customerSessionId>
<minorRev>##</minorRev> <locale>en_US</locale> <currencyCode>USD</currencyCode> ...
REST 通用元素
http://api.ean.com/ean-services/rs/hotel/v3/{serviceName}?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&_type=json
...


酒店列表

对您的列表请求进行的最重要更改是 REST API 的独特客房对象结构,它将以前 SOAP 元素中的值压缩为逗号分隔的列表:

&room[room number, starting with 1]= [number of adults], [first child's age], [second child's age], [etc]


请注意,REST 中对于 SOAP 和 XML 中使用的 numberOfChildren 元素没有直接对等项。相反,每间客房的儿童住客计数由提供的儿童年龄值数确定。

以下示例请求相同的入住人数:一间客房住两位成人、两个年龄为 8 岁和 12 岁的儿童,一间客房仅住两位成人。

SOAP 通用元素
<soapenv:Body>
<v3:{serviceName}>
<{requestParentElement}>
<apiKey>#####</apiKey>
<cid>######</cid>
<customerIpAddress>##########</customerIpAddress> <customerUserAgent>##########</customerUserAgent> <customerSessionId>##########</customerSessionId>
<minorRev>##</minorRev> <locale>en_US</locale> <currencyCode>USD</currencyCode> ...
REST 通用元素
http://api.ean.com/ean-services/rs/hotel/v3/{serviceName}?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&_type=json
...


酒店列表

对您的列表请求进行的最重要更改是 REST API 的独特客房对象结构,它将以前 SOAP 元素中的值压缩为逗号分隔的列表:

&room[room number, starting with 1]= [number of adults], [first child's age], [second child's age], [etc]


请注意,REST 中对于 SOAP 和 XML 中使用的 numberOfChildren 元素没有直接对等项。相反,每间客房的儿童住客计数由提供的儿童年龄值数确定。

以下示例请求相同的入住人数:一间客房住两位成人、两个年龄为 8 岁和 12 岁的儿童,一间客房仅住两位成人。

SOAP 列表请求
<v3:getList>
<HotelListRequest>
<apiKey>#####</apiKey>
<cid>######</cid>
<customerIpAddress>##########</customerIpAddress> <customerUserAgent>##########</customerUserAgent> <customerSessionId>##########</customerSessionId>
<minorRev>##</minorRev> <locale>en_US</locale> <currencyCode>USD</currencyCode>
<destinationString>Milan, Italy</destinationString>
<arrivalDate>08/10/2014</arrivalDate>
<departureDate>08/12/2014</departureDate>
<RoomGroup>
<Room>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>2</numberOfChildren> <childAges>8</childAges> <childAges>12</childAges>
</Room> <Room>
<numberOfAdults>2</numberOfAdults>
</Room>
</RoomGroup>
</HotelListRequest>
</v3:getList>
REST 列表请求
http://api.ean.com/ean-services/rs/hotel/v3/list?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&_type=json
&destinationString=Milan, Italy
&arrivalDate=08/10/2014
&departureDate=08/12/2014
&room1=2,8,12
&room2=2


列表回复
SOAP 列表回复
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getListResponse xmlns:ns2="http://v3.hotel.wsapi.ean.com/">
<HotelListResponse>
<customerSessionId>0ABAAACD-8CA1-3191-46D2-55EAD0C935EA</customerSessionId>
<numberOfRoomsRequested>2</numberOfRoomsRequested>
<moreResultsAvailable>true</moreResultsAvailable>
<cacheKey>768ca131:146d55ead0c:35f1</cacheKey>
<cacheLocation>10.186.170.205:7300</cacheLocation>
<cachedSupplierResponse supplierCacheTolerance="NOT_SUPPORTED" cachedTime="0" supplierRequestNum="476" supplierResponseNum="1" supplierResponseTime="108" candidatePreptime="82" otherOverheadTime="34" tpidUsed="5001" matchedCurrency="true" matchedLocale="true"/>
<HotelList size="1" activePropertyCount="532">
<HotelSummary order="0" ubsScore="70578488">
<hotelId>124869</hotelId>
<name>Novotel Milan Nord Ca Granda</name>
<address1>Viale Giovanni Suzzani 13</address1>
<city>Milan</city>
<postalCode>20162</postalCode>
<countryCode>IT</countryCode>
<airportCode>LIN</airportCode>
<supplierType>E</supplierType>
<propertyCategory>1</propertyCategory>
<hotelRating>4.0</hotelRating>
<confidenceRating>50</confidenceRating>
<amenityMask>33587339</amenityMask>
<locationDescription>In Milan (Niguarda)</locationDescription>
<shortDescription><![CDATA[&lt;p&gt;&lt;b&gt;Property Location&lt;/b&gt; &lt;br /&gt;With a stay at Novotel Milan Nord Ca Granda in Milan (Niguarda), you&apos;ll be close to Niguarda Ca Granda Hospital and Cathedral of Milan. This 4-star hotel is within]]></shortDescription>
<highRate>103.05</highRate>
<lowRate>103.05</lowRate>
<rateCurrencyCode>USD</rateCurrencyCode>
<latitude>45.5062</latitude>
<longitude>9.19759</longitude>
<proximityDistance>2.127312</proximityDistance>
<proximityUnit>MI</proximityUnit>
<hotelInDestination>true</hotelInDestination>
<thumbNailUrl>/hotels/1000000/20000/11500/11430/11430_86_t.jpg</thumbNailUrl>
<deepLink>{removed for brevity}</deepLink>
<RoomRateDetailsList>
<RoomRateDetails>
<roomTypeCode>185262</roomTypeCode>
<rateCode>200103261</rateCode>
<maxRoomOccupancy>4</maxRoomOccupancy>
<quotedRoomOccupancy>2</quotedRoomOccupancy>
<minGuestAge>0</minGuestAge>
<roomDescription>Superior Room, 1 King Bed with Sofabed</roomDescription>
<propertyAvailable>true</propertyAvailable>
<propertyRestricted>false</propertyRestricted>
<expediaPropertyId>11430</expediaPropertyId>
<RateInfos size="1">
<RateInfo priceBreakdown="true" promo="true" rateChange="false">
<RoomGroup>
<Room>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>2</numberOfChildren>
<childAges>8</childAges>
<childAges>12</childAges>
</Room>
<Room>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>0</numberOfChildren>
</Room>
</RoomGroup>
<ChargeableRateInfo averageBaseRate="103.05" averageRate="103.05" commissionableUsdTotal="412.2" currencyCode="USD" maxNightlyRate="103.05" nightlyRateTotal="412.2" surchargeTotal="22.68" total="434.88">
<NightlyRatesPerRoom size="2">
<NightlyRate baseRate="103.05" rate="103.05" promo="false"/>
<NightlyRate baseRate="103.05" rate="103.05" promo="false"/>
</NightlyRatesPerRoom>
<Surcharges size="1">
<Surcharge type="TaxAndServiceFee" amount="22.68"/>
</Surcharges>
</ChargeableRateInfo>
<nonRefundable>true</nonRefundable>
<HotelFees size="1">
<HotelFee description="MandatoryTax" amount="109.05"/>
</HotelFees>
<rateType>MerchantStandard</rateType>
<promoId>205982103</promoId>
<promoDescription>Sale! Save 30% on this Stay.</promoDescription>
<promoType>Standard</promoType>
<currentAllotment>0</currentAllotment>
</RateInfo>
</RateInfos>
<ValueAdds size="1">
<ValueAdd id="2048">
<description>Free Wireless Internet</description>
</ValueAdd>
</ValueAdds>
</RoomRateDetails>
</RoomRateDetailsList>
</HotelSummary>
</HotelList>
</HotelListResponse>
</ns2:getListResponse>
</soap:Body>
</soap:Envelope>
JSON 列表回复
    {
"HotelListResponse": {
"customerSessionId": "0ABAAA7C-15C0-2291-46D2-4F67C5B91386",
"numberOfRoomsRequested": 2,
"moreResultsAvailable": true,
"cacheKey": "5315c022:146d4f67c5b:138c",
"cacheLocation": "10.186.170.124:7300",
"cachedSupplierResponse": {
"@supplierCacheTolerance": "NOT_SUPPORTED",
"@cachedTime": "0",
"@supplierRequestNum": "476",
"@supplierResponseNum": "1",
"@supplierResponseTime": "109",
"@candidatePreptime": "14",
"@otherOverheadTime": "25",
"@tpidUsed": "5001",
"@matchedCurrency": "true",
"@matchedLocale": "true"
},
"HotelList": {
"@size": "1",
"@activePropertyCount": "532",
"HotelSummary": {
"@order": "0",
"@ubsScore": "70790284",
"hotelId": 124869,
"name": "Novotel Milan Nord Ca Granda",
"address1": "Viale Giovanni Suzzani 13",
"city": "Milan",
"postalCode": 20162,
"countryCode": "IT",
"airportCode": "LIN",
"supplierType": "E",
"propertyCategory": 1,
"hotelRating": 4,
"confidenceRating": 50,
"amenityMask": 33587339,
"locationDescription": "In Milan (Niguarda)",
"shortDescription": "&lt;p&gt;&lt;b&gt;Property Location&lt;/b&gt; &lt;br /&gt;With a stay at Novotel Milan Nord Ca Granda in Milan (Niguarda), you&apos;ll be close to Niguarda Ca Granda Hospital and Cathedral of Milan. This 4-star hotel is within",
"highRate": 102.86,
"lowRate": 102.86,
"rateCurrencyCode": "USD",
"latitude": 45.5062,
"longitude": 9.19759,
"proximityDistance": 2.127312,
"proximityUnit": "MI",
"hotelInDestination": true,
"thumbNailUrl": "/hotels/1000000/20000/11500/11430/11430_86_t.jpg",
"deepLink": {removed for brevity}
"RoomRateDetailsList": {
"RoomRateDetails": {
"roomTypeCode": 185262,
"rateCode": 200103261,
"maxRoomOccupancy": 4,
"quotedRoomOccupancy": 2,
"minGuestAge": 0,
"roomDescription": "Superior Room, 1 King Bed with Sofabed",
"propertyAvailable": true,
"propertyRestricted": false,
"expediaPropertyId": 11430,
"RateInfos": {
"@size": "1",
"RateInfo": {
"@priceBreakdown": "true",
"@promo": "true",
"@rateChange": "false",
"RoomGroup": {
"Room": [
{
"numberOfAdults": 2,
"numberOfChildren": 2,
"childAges": [
8,
12
]
},
{
"numberOfAdults": 2,
"numberOfChildren": 0
}
]
},
"ChargeableRateInfo": {
"@averageBaseRate": "102.86",
"@averageRate": "102.86",
"@commissionableUsdTotal": "411.44",
"@currencyCode": "USD",
"@maxNightlyRate": "102.86",
"@nightlyRateTotal": "411.44",
"@surchargeTotal": "22.64",
"@total": "434.08",
"NightlyRatesPerRoom": {
"@size": "2",
"NightlyRate": [
{
"@baseRate": "102.86",
"@rate": "102.86",
"@promo": "false"
},
{
"@baseRate": "102.86",
"@rate": "102.86",
"@promo": "false"
}
]
},
"Surcharges": {
"@size": "1",
"Surcharge": {
"@type": "TaxAndServiceFee",
"@amount": "22.64"
}
}
},
"nonRefundable": true,
"HotelFees": {
"@size": "1",
"HotelFee": {
"@description": "MandatoryTax",
"@amount": "108.84"
}
},
"rateType": "MerchantStandard",
"promoId": 205982103,
"promoDescription": "Sale! Save 30% on this Stay.",
"promoType": "Standard",
"currentAllotment": 0
}
},
"ValueAdds": {
"@size": "1",
"ValueAdd": {
"@id": "2048",
"description": "Free Wireless Internet"
}
}
}
}
}
}
}
}


可订空房

对于可订空房请求,集成所有必需的通用元素和特定于 REST 的客房组格式,如前面有关酒店列表请求的详细说明所述。没有仅针对可订空房请求的更新。

SOAP 可订空房请求
<v3:getAvailability>
<HotelRoomAvailabilityRequest> <apiKey>#####</apiKey>
<cid>######</cid>
<customerIpAddress>##########</customerIpAddress> <customerUserAgent>##########</customerUserAgent> <customerSessionId>##########</customerSessionId>
<minorRev>##</minorRev> <locale>en_US</locale> <currencyCode>USD</currencyCode>
<hotelId>124869</hotelId>
<arrivalDate>08/10/2014</arrivalDate>
<departureDate>08/12/2014</departureDate>
<RoomGroup>
<Room>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>2</numberOfChildren> <childAges>8</childAges> <childAges>12</childAges>
</Room> <Room>
<numberOfAdults>2</numberOfAdults>
</Room>
</RoomGroup> <includeDetails>true</includeDetails>
</HotelRoomAvailabilityRequest>
</v3:getAvailability>
REST 可订空房请求
http://api.ean.com/ean-services/rs/hotel/v3/avail?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&_type=json
&hotelId=124869
&arrivalDate=08/10/2014
&departureDate=08/12/2014
&includeDetails=true
&room1=2,8,12
&room2=2
    
可订空房回复

确保您通过用橙色突出显示的回复元素捕获单个值客户的选择(如果适用)。这些值必须通过您的预订请求所需的相应元素进行传递。

简而言之,仅第一间客房会显示请求的入住人数。请注意,HotelFeeBreakdown 仅在 REST 示例中返回,如果在 REST 下将其忽略,则请求参数 includeHotelFeeBreakdown 默认为 true

SOAP 可订空房回复
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getAvailabilityResponse xmlns:ns2="http://v3.hotel.wsapi.ean.com/">
<HotelRoomAvailabilityResponse size="8">
<customerSessionId>0ABAAA40-F6D7-B914-7452-5318ED902AB5</customerSessionId>
<hotelId>124869</hotelId>
<arrivalDate>08/10/2014</arrivalDate>
<departureDate>08/12/2014</departureDate>
<hotelName>Novotel Milan Nord Ca Granda</hotelName>
<hotelAddress>Viale Giovanni Suzzani 13</hotelAddress>
<hotelCity>Milan</hotelCity>
<hotelCountry>IT</hotelCountry>
<numberOfRoomsRequested>2</numberOfRoomsRequested>
<checkInInstructions>{removed for brevity}</checkInInstructions>
<HotelRoomResponse>
<rateCode>201985271</rateCode>
<roomTypeCode>185262</roomTypeCode>
<rateDescription>Superior Room, 1 King Bed with Sofabed</rateDescription>
<roomTypeDescription>Superior Room, 1 King Bed with Sofabed</roomTypeDescription>
<supplierType>E</supplierType>
<propertyId>11430</propertyId>
<BedTypes size="1">
<BedType id="67">
<description>1 king and 1 sofa bed</description>
</BedType>
</BedTypes>
<smokingPreferences>S,NS</smokingPreferences>
<rateOccupancyPerRoom>4</rateOccupancyPerRoom>
<quotedOccupancy>2</quotedOccupancy>
<minGuestAge>0</minGuestAge>
<RateInfos size="1">
<RateInfo priceBreakdown="true" promo="false" rateChange="true">
<RoomGroup>
<Room>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>2</numberOfChildren>
<childAges>8</childAges>
<childAges>12</childAges>
<rateKey>0b07a27f-74dc-4a70-b4ac-c67766eb1342</rateKey>
</Room>
<Room>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>0</numberOfChildren>
<rateKey>0b07a27f-74dc-4a70-b4ac-c67766eb1342</rateKey>
</Room>
</RoomGroup>
<ChargeableRateInfo averageBaseRate="108.905" averageRate="108.905" commissionableUsdTotal="435.62" currencyCode="USD" maxNightlyRate="115.71" nightlyRateTotal="435.62" surchargeTotal="23.96" total="459.58">
<NightlyRatesPerRoom size="2">
<NightlyRate baseRate="114.97" rate="114.97" promo="false"/>
<NightlyRate baseRate="128.5" rate="128.5" promo="false"/>
</NightlyRatesPerRoom>
<Surcharges size="1">
<Surcharge type="TaxAndServiceFee" amount="23.96"/>
</Surcharges>
</ChargeableRateInfo>
<cancellationPolicy>This rate is non-refundable and cannot be changed or cancelled - if you do choose to change or cancel this booking you will not be refunded any of the payment.</cancellationPolicy>
<CancelPolicyInfoList>
<CancelPolicyInfo>
<versionId>206382052</versionId>
<cancelTime>18:00:00</cancelTime>
<startWindowHours>0</startWindowHours>
<nightCount>0</nightCount>
<percent>100</percent>
<currencyCode>USD</currencyCode>
<timeZoneDescription>(GMT+01:00) Brussels, Copenhagen, Madrid, Paris</timeZoneDescription>
</CancelPolicyInfo>
<CancelPolicyInfo>
<versionId>206382051</versionId>
<cancelTime>18:00:00</cancelTime>
<startWindowHours>999</startWindowHours>
<nightCount>0</nightCount>
<percent>100</percent>
<currencyCode>USD</currencyCode>
<timeZoneDescription>(GMT+01:00) Brussels, Copenhagen, Madrid, Paris</timeZoneDescription>
</CancelPolicyInfo>
</CancelPolicyInfoList>
<nonRefundable>true</nonRefundable>
<HotelFees size="1">
<HotelFee description="MandatoryTax" amount="81.16"/>
</HotelFees>
<rateType>MerchantStandard</rateType>
<currentAllotment>0</currentAllotment>
<guaranteeRequired>false</guaranteeRequired>
<depositRequired>true</depositRequired>
<taxRate>26.78</taxRate>
</RateInfo>
</RateInfos>
<ValueAdds size="1">
<ValueAdd id="16777216">
<description>Breakfast Buffet</description>
</ValueAdd>
</ValueAdds>
<deepLink>{removed for brevity}</deepLink>
</HotelRoomResponse>

{other room options removed for brevity}
</HotelRoomAvailabilityResponse>
</ns2:getAvailabilityResponse>
</soap:Body>
</soap:Envelope>
JSON 可订空房回复
{
"HotelRoomAvailabilityResponse": {
"@size": "8",
"customerSessionId": "0ABAAA8A-00AA-9091-4712-CE0FE89929BF",
"hotelId": 124869,
"arrivalDate": "08\/10\/2014",
"departureDate": "08\/12\/2014",
"hotelName": "Novotel Milan Nord Ca Granda",
"hotelAddress": "Viale Giovanni Suzzani 13",
"hotelCity": "Milan",
"hotelCountry": "IT",
"numberOfRoomsRequested": 2,
"checkInInstructions": {removed for brevity}
"HotelRoomResponse": [
{
"rateCode": 201985271,
"roomTypeCode": 185262,
"rateDescription": "Superior Room, 1 King Bed with Sofabed",
"roomTypeDescription": "Superior Room, 1 King Bed with Sofabed",
"supplierType": "E",
"propertyId": 11430,
"BedTypes": {
"@size": "1",
"BedType": {
"@id": "67",
"description": "1 king and 1 sofa bed"
}
},
"smokingPreferences": "S,NS",
"rateOccupancyPerRoom": 4,
"quotedOccupancy": 2,
"minGuestAge": 0,
"RateInfos": {
"@size": "1",
"RateInfo": {
"@priceBreakdown": "true",
"@promo": "false",
"@rateChange": "true",
"RoomGroup": {
"Room": [
{
"numberOfAdults": 2,
"numberOfChildren": 2,
"childAges": [
8,
12
],
"rateKey": "9d451f73-4a54-48e9-bf18-f8a54e205af1"
},
{
"numberOfAdults": 2,
"numberOfChildren": 0,
"rateKey": "9d451f73-4a54-48e9-bf18-f8a54e205af1"
}
]
},
"ChargeableRateInfo": {
"@averageBaseRate": "108.905",
"@averageRate": "108.905",
"@commissionableUsdTotal": "435.62",
"@currencyCode": "USD",
"@maxNightlyRate": "115.71",
"@nightlyRateTotal": "435.62",
"@surchargeTotal": "23.96",
"@total": "459.58",
"NightlyRatesPerRoom": {
"@size": "2",
"NightlyRate": [
{
"@baseRate": "102.1",
"@rate": "102.1",
"@promo": "false"
},
{
"@baseRate": "115.71",
"@rate": "115.71",
"@promo": "false"
}
]
},
"Surcharges": {
"@size": "1",
"Surcharge": {
"@type": "TaxAndServiceFee",
"@amount": "23.96"
}
}
},
"cancellationPolicy": "This rate is non-refundable and cannot be changed or cancelled - if you do choose to change or cancel this booking you will not be refunded any of the payment.",
"CancelPolicyInfoList": {
"CancelPolicyInfo": [
{
"versionId": 206382052,
"cancelTime": "18:00:00",
"startWindowHours": 0,
"nightCount": 0,
"percent": 100,
"currencyCode": "USD",
"timeZoneDescription": "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris"
},
{
"versionId": 206382051,
"cancelTime": "18:00:00",
"startWindowHours": 999,
"nightCount": 0,
"percent": 100,
"currencyCode": "USD",
"timeZoneDescription": "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris"
}
]
},
"nonRefundable": true,
"HotelFees": {
"@size": "1",
"HotelFee": {
"@description": "MandatoryTax",
"@amount": "81.68",
"HotelFeeBreakdown": {
"@unit": "Per person",
"@frequency": "Per night"
}
}
},
"rateType": "MerchantStandard",
"currentAllotment": 0,
"guaranteeRequired": false,
"depositRequired": true,
"taxRate": 23.96
}
},
"ValueAdds": {
"@size": "1",
"ValueAdd": {
"@id": "16777216",
"description": "Breakfast Buffet"
}
},
"deepLink": {removed for brevity}
},
{other room options removed for brevity}
]
}
}


预订

在尝试首次测试预订之前,根据以下要点检查您的集成。这些要点是合作伙伴从 SOAP 更新为 REST 时最常出现问题的地方。

  • 以下示例中用橙色突出显示的元素是必需项,必须传递可订空房回复中的相应值:
    • 将客户的选择用于吸烟喜好忽略该元素(如果在客房回复中未提供该元素)。
    • 每间客房的 BedTypeId 值必须使用客房回复中的对应 BedType @id 属性
    • 必须从客房回复中传递与客户的客房选择对应的 roomTypeCodechargeableRate @total,rateCode 值。
    • 始终使用客房回复的 rateKey 值,不管具体的客房选择如何都是如此。
  • 查看我们的完整预订请求文档并确认是否所有必需元素均已提供并且具有规定的格式。
    • 确保客户输入值根据所需的格式正确进行验证。例如 stateProvinceCodecountryCode 仅接受两个字符组成的代码,全名或任何其他值格式都将导致预订失败。
SOAP 预订请求
<v3:getReservation>
<HotelRoomReservationRequest>
<apiKey>#####</apiKey>
<cid>######</cid>
<customerIpAddress>##########</customerIpAddress> <customerUserAgent>##########</customerUserAgent> <customerSessionId>##########</customerSessionId>
<minorRev>##</minorRev> <locale>en_US</locale> <currencyCode>USD</currencyCode>
<hotelId>124869</hotelId>
<arrivalDate>08/10/2014</arrivalDate>
<departureDate>08/12/2014</departureDate>
<supplierType>E</supplierType>
<rateKey>e5b389fc-486b-404a-a819-259ab955eb8b</rateKey>
<roomTypeCode>185262</roomTypeCode>
<rateCode>446847</rateCode>
<chargeableRate>518.11</chargeableRate>
<RoomGroup>
<Room>
<firstName>test</firstName>
<lastName>tester</lastName>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>2</numberOfChildren>
<childAges>8</childAges>
<childAges>12</childAges> <bedTypeId>67</bedTypeId>
<smokingPreference>NS</smokingPreference>
</Room> <Room> <firstName>test</firstName>
<lastName>tester</lastName>
<numberOfAdults>2</numberOfAdults> <bedTypeId>67</bedTypeId>
<smokingPreference>NS</smokingPreference>
</Room>
</RoomGroup>
<ReservationInfo>
<email>test@yourdomain.com</email>
<firstName>test</firstName>
<lastName>tester</lastName>
<homePhone>##########</homePhone>
<workPhone>##########</workPhone>
<creditCardType>##</creditCardType>
<creditCardNumber>#################</creditCardNumber>
<creditCardIdentifier>123</creditCardIdentifier>
<creditCardExpirationMonth>11</creditCardExpirationMonth>
<creditCardExpirationYear>2016</creditCardExpirationYear>
</ReservationInfo>
<AddressInfo>
<address1>travelnow</address1>
<city>Seattle</city>
<stateProvinceCode>WA</stateProvinceCode>
<countryCode>US</countryCode>
<postalCode>98004</postalCode>
</AddressInfo>
</HotelRoomReservationRequest> </v3:getReservation>
REST 预订请求
https://book.api.ean.com/ean-services/rs/hotel/v3/res?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&_type=json
&hotelId=124869
&arrivalDate=08/10/2014
&departureDate=08/12/2014
&supplierType=E
&rateKey=e5b389fc-486b-404a-a819-259ab955eb8b
&roomTypeCode=185262
&rateCode=446847
&chargeableRate=518.11
&room1=2,8,12
&room1FirstName=test
&room1LastName=tester
&room1BedTypeId=67
&room1SmokingPreference=NS
&room2=1
&room2FirstName=test
&room2LastName=tester
&room2BedTypeId=67
&room2SmokingPreference=NS
&email=test@yourdomain.com
&firstName=tester
&lastName=testing
&homePhone=##########
&workPhone=##########
&creditCardType=CA
&creditCardNumber=#################
&creditCardIdentifier=123
&creditCardExpirationMonth=11
&creditCardExpirationYear=2016
&address1=travelnow
&city=Seattle
&stateProvinceCode=WA
&countryCode=US
&postalCode=98004 
    


预订回复

SOAP 预订回复
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getReservationResponse xmlns:ns2="http://v3.hotel.wsapi.ean.com/">
<HotelRoomReservationResponse>
<customerSessionId>0ABAAA7D-2A56-5914-7452-7D1C8B902456</customerSessionId>
<itineraryId>####</itineraryId>
<confirmationNumbers>1234</confirmationNumbers>
<confirmationNumbers>1235</confirmationNumbers>
<processedWithConfirmation>true</processedWithConfirmation>
<supplierType>E</supplierType>
<reservationStatusCode>CF</reservationStatusCode>
<existingItinerary>false</existingItinerary>
<numberOfRoomsBooked>2</numberOfRoomsBooked>
<drivingDirections/>
<checkInInstructions/>
<arrivalDate>08/10/2014</arrivalDate>
<departureDate>08/12/2014</departureDate>
<hotelName>Novotel Milan Nord Ca Granda</hotelName>
<hotelAddress>Viale Giovanni Suzzani 13</hotelAddress>
<hotelCity>Milan</hotelCity>
<hotelPostalCode>20162</hotelPostalCode>
<hotelCountryCode>IT</hotelCountryCode>
<roomDescription>Superior Room, 1 King Bed with Sofabed</roomDescription>
<rateOccupancyPerRoom>3</rateOccupancyPerRoom>
<RateInfos size="1">
<RateInfo priceBreakdown="true" promo="false" rateChange="true">
<RoomGroup>
<Room>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>2</numberOfChildren>
<childAges>8</childAges>
<childAges>12</childAges>
<firstName>test</firstName>
<lastName>tester</lastName>
<bedTypeId>67</bedTypeId>
<bedTypeDescription>1 king and 1 sofa bed</bedTypeDescription>
<smokingPreference>NS</smokingPreference>
</Room>
<Room>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>0</numberOfChildren>
<firstName>test</firstName>
<lastName>tester</lastName>
<bedTypeId>67</bedTypeId>
<bedTypeDescription>1 king and 1 sofa bed</bedTypeDescription>
<smokingPreference>NS</smokingPreference>
</Room>
</RoomGroup>
<ChargeableRateInfo averageBaseRate="122.77" averageRate="122.77" commissionableUsdTotal="491.08" currencyCode="USD" maxNightlyRate="129.59" nightlyRateTotal="491.08" surchargeTotal="27.02" total="518.1">
<NightlyRatesPerRoom size="2">
<NightlyRate baseRate="115.95" rate="115.95" promo="false"/>
<NightlyRate baseRate="129.59" rate="129.59" promo="false"/>
</NightlyRatesPerRoom>
<Surcharges size="1">
<Surcharge type="TaxAndServiceFee" amount="27.02"/>
</Surcharges>
</ChargeableRateInfo>
<cancellationPolicy>We understand that sometimes your travel plans change. We do not charge a change or cancel fee. However, this property (Novotel Milan Nord Ca Granda) imposes the following penalty to its customers that we are required to pass on: Cancellations or changes made after 5:00 PM ((GMT+01:00) Brussels, Copenhagen, Madrid, Paris) on Aug 10, 2014 are subject to a 1 Night Room &amp; Tax penalty. The property makes no refunds for no shows or early checkouts.</cancellationPolicy> <CancelPolicyInfoList>
<CancelPolicyInfo>
<versionId>209134416</versionId>
<cancelTime>18:00:00</cancelTime>
<startWindowHours>0</startWindowHours>
<nightCount>1</nightCount>
<currencyCode>USD</currencyCode>
<timeZoneDescription>(GMT+01:00) Brussels, Copenhagen, Madrid, Paris</timeZoneDescription>
</CancelPolicyInfo>
<CancelPolicyInfo>
<versionId>209134415</versionId>
<cancelTime>18:00:00</cancelTime>
<startWindowHours>1</startWindowHours>
<nightCount>0</nightCount>
<currencyCode>USD</currencyCode>
<timeZoneDescription>(GMT+01:00) Brussels, Copenhagen, Madrid, Paris</timeZoneDescription>
</CancelPolicyInfo>
</CancelPolicyInfoList>
<nonRefundable>false</nonRefundable>
<HotelFees size="1">
<HotelFee description="MandatoryTax" amount="81.16">
<HotelFeeBreakdown unit="Per person" frequency="Per night"/>
</HotelFee>
</HotelFees>
<rateType>MerchantStandard</rateType>
</RateInfo>
</RateInfos>
</HotelRoomReservationResponse>
</ns2:getReservationResponse>
</soap:Body>
</soap:Envelope>
JSON 预订回复
{
"HotelRoomReservationResponse": {
"customerSessionId": "0ABAAACE-8D64-3191-4722-1D3859B948E8",
"itineraryId": ####,
"confirmationNumbers": [
1234,
1235
],
"processedWithConfirmation": true,
"supplierType": "E",
"reservationStatusCode": "CF",
"existingItinerary": false,
"numberOfRoomsBooked": 2,
"drivingDirections": "",
"checkInInstructions": "",
"arrivalDate": "08\/10\/2014",
"departureDate": "08\/12\/2014",
"hotelName": "Novotel Milan Nord Ca Granda",
"hotelAddress": "Viale Giovanni Suzzani 13",
"hotelCity": "Milan",
"hotelPostalCode": 20162,
"hotelCountryCode": "IT",
"roomDescription": "Superior Room, 1 King Bed with Sofabed",
"rateOccupancyPerRoom": 3,
"RateInfos": {
"@size": "1",
"RateInfo": {
"@priceBreakdown": "true",
"@promo": "false",
"@rateChange": "true",
"RoomGroup": {
"Room": [
{
"numberOfAdults": 2,
"numberOfChildren": 2,
"childAges": [
8,
12
],
"firstName": "test",
"lastName": "tester",
"bedTypeId": 67,
"bedTypeDescription": "1 king and 1 sofa bed",
"smokingPreference": "NS"
},
{
"numberOfAdults": 1,
"numberOfChildren": 0,
"firstName": "test",
"lastName": "tester",
"bedTypeId": 67,
"bedTypeDescription": "1 king and 1 sofa bed",
"smokingPreference": "NS"
}
]
},
"ChargeableRateInfo": {
"@averageBaseRate": "122.77",
"@averageRate": "122.77",
"@commissionableUsdTotal": "491.08",
"@currencyCode": "USD",
"@maxNightlyRate": "129.59",
"@nightlyRateTotal": "491.08",
"@surchargeTotal": "27.02",
"@total": "518.1",
"NightlyRatesPerRoom": {
"@size": "2",
"NightlyRate": [
{
"@baseRate": "115.95",
"@rate": "115.95",
"@promo": "false"
},
{
"@baseRate": "129.59",
"@rate": "129.59",
"@promo": "false"
}
]
},
"Surcharges": {
"@size": "1",
"Surcharge": {
"@type": "TaxAndServiceFee",
"@amount": "27.02"
}
}
},
"cancellationPolicy": "We understand that sometimes your travel plans change. We do not charge a change or cancel fee. However, this property (Novotel Milan Nord Ca Granda) imposes the following penalty to its customers that we are required to pass on: Cancellations or changes made after 5:00 PM ((GMT+01:00) Brussels, Copenhagen, Madrid, Paris) on Aug 10, 2014 are subject to a 1 Night Room & Tax penalty. The property makes no refunds for no shows or early checkouts.",
"CancelPolicyInfoList": {
"CancelPolicyInfo": [
{
"versionId": 209134416,
"cancelTime": "18:00:00",
"startWindowHours": 0,
"nightCount": 1,
"currencyCode": "USD",
"timeZoneDescription": "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris"
},
{
"versionId": 209134415,
"cancelTime": "18:00:00",
"startWindowHours": 1,
"nightCount": 0,
"currencyCode": "USD",
"timeZoneDescription": "(GMT+01:00) Brussels, Copenhagen, Madrid, Paris"
}
]
},
"nonRefundable": false,
"HotelFees": {
"@size": "1",
"HotelFee": {
"@description": "MandatoryTax",
"@amount": "68.20",
"HotelFeeBreakdown": {
"@unit": "Per person",
"@frequency": "Per night"
}
}
},
"rateType": "MerchantStandard"
}
}
}
}


行程请求

行程请求仅在指定日期返回时存在不同之处。在 REST 下,只需忽略 <ItineraryQuery> 元素并直接提供您的创建或离店日期参数。没有仅针对单个行程检索的更新。

SOAP 行程请求 - 单个行程
<v3:getItinerary>
<HotelItineraryRequest>
<apiKey>#####</apiKey>
<cid>#####</cid>
<customerIpAddress>xxx</customerIpAddress>
<customerSessionId>xxx</customerSessionId>
<customerUserAgent>xxx</customerUserAgent> <minorRev>##</minorRev>
<locale>en_US</locale>
<currencyCode>USD</currencyCode> <itineraryId>##########</itineraryId>
<email>test@travelnow.com</email>
</HotelItineraryRequest>
</v3:getItinerary>
REST 行程请求 - 单个行程
http://api.ean.com/ean-services/rs/hotel/v3/itin?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&_type=json
&itineraryId=#########
&email=test@travelnow.com
    

SOAP 行程请求 - 日期范围
<v3:getItinerary>
<HotelItineraryRequest>
<apiKey>#####</apiKey>
<cid>#####</cid>
<customerIpAddress>xxx</customerIpAddress>
<customerSessionId>xxx</customerSessionId>
<customerUserAgent>xxx</customerUserAgent> <minorRev>##</minorRev>
<locale>en_US</locale>
<currencyCode>USD</currencyCode> <ItineraryQuery> <creationDateStart>09/1/2014</creationDateStart> <creationDateEnd>09/8/2014</creationDateEnd> </ItineraryQuery>
</HotelItineraryRequest>
</v3:getItinerary>
REST 行程请求 - 日期范围
http://api.ean.com/ean-services/rs/hotel/v3/itin?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&_type=json
&creationDateStart=09/01/2014
&creationDateEnd=09/08/2014
    
行程回复

所有 SOAP 行程回复都在自己的 Itinerary 对象中存放每个行程。

在 REST 下,仅对于创建或离店日期范围,会在单个 Itinerary 对象中以数字方式为行程编制索引,并且第一个行程从 0 开始。各个行程请求仍在单个 Itinerary 对象中返回数据。为简便起见,下面仅提供了日期范围回复示例。

SOAP 行程回复 - 日期范围
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getItineraryResponse xmlns:ns2="http://v3.hotel.wsapi.ean.com/">
<HotelItineraryResponse size="17">
<customerSessionId>xxx</customerSessionId>
<Itinerary>
<itineraryId>##########</itineraryId>
<affiliateId>######</affiliateId>
<creationDate>09/03/2014</creationDate>
<creationTime>15:13:11 CDT</creationTime>
<itineraryStartDate>10/03/2014</itineraryStartDate>
<itineraryEndDate>10/05/2014</itineraryEndDate>
<Customer>
<email>test@travelnow.com</email>
<firstName>test</firstName>
<lastName>tester</lastName>
<homePhone>#########</homePhone>
<workPhone>#########</workPhone>
<CustomerAddresses>
<address1>travelnow</address1>
<city>Seattle</city>
<stateProvinceCode>WA</stateProvinceCode>
<countryCode>US</countryCode>
<postalCode>98004</postalCode>
<isPrimary>true</isPrimary>
<type>1</type>
</CustomerAddresses>
</Customer>
<HotelConfirmation>
<supplierId>13</supplierId>
<chainCode>EP</chainCode>
<arrivalDate>10/03/2014</arrivalDate>
<departureDate>10/05/2014</departureDate>
<confirmationNumber>1234</confirmationNumber>
<RateInfos size="1">
<RateInfo priceBreakdown="true" promo="false" rateChange="false">
<ChargeableRateInfo averageBaseRate="8941.0" averageRate="8941.0" commissionableUsdTotal="170.14" currencyCode="JPY" maxNightlyRate="8941.0" nightlyRateTotal="17882.0" total="17882.0">
<NightlyRatesPerRoom size="2">
<NightlyRate baseRate="8941.0" rate="8941.0" promo="false"/>
<NightlyRate baseRate="8941.0" rate="8941.0" promo="false"/>
</NightlyRatesPerRoom>
</ChargeableRateInfo>
<cancellationPolicy>Ce montant ne peut être ni remboursé, ni modifié, ni annulé. Si vous décidez tout de même de modifier ou annuler cette réservation, vos paiements ne vous seront pas remboursés.</cancellationPolicy>
<nonRefundable>true</nonRefundable>
<online>true</online>
<HotelFees size="1">
<HotelFee description="MandatoryTax" amount="1919"/>
</HotelFees>
<rateType>MerchantStandard</rateType>
</RateInfo>
</RateInfos>
<numberOfAdults>2</numberOfAdults>
<numberOfChildren>0</numberOfChildren>
<smokingPreference>N</smokingPreference>
<supplierPropertyId>525133</supplierPropertyId>
<roomTypeCode>176765</roomTypeCode>
<rateCode>1086015</rateCode>
<rateDescription>Réservez tôt et économisez 14%</rateDescription>
<roomDescription>Chambre Double Standard</roomDescription>
<status>DT</status>
<locale>fr_FR</locale>
<ReservationGuest>
<firstName>test</firstName>
<lastName>tester</lastName>
</ReservationGuest>
<Hotel>
<hotelId>113856</hotelId>
<statusCode>A</statusCode>
<name>Hotel BLOOM</name>
<address1>Rue Royale 250</address1>
<city>Brussels</city>
<countryCode>BE</countryCode>
<postalCode>1210</postalCode>
<phone>32-22-206611</phone>
<fax>32-22-178444</fax>
<latitude>50.8552</latitude>
<longitude>4.36673</longitude>
<coordinateAccuracyCode>1</coordinateAccuracyCode>
<lowRate>154.7501</lowRate>
<highRate>297.7253</highRate>
<confidence>88</confidence>
<hotelRating>4.0</hotelRating>
<tripAdvisorRating>4.0</tripAdvisorRating>
<market>Brussels, Belgium</market>
<region>Benelux</region>
<superRegion>EMEA</superRegion>
<theme>Business Hotel</theme>
</Hotel>
<nights>2</nights>
</HotelConfirmation>
</Itinerary>
<Itinerary>
<itineraryId>169502105</itineraryId>
<affiliateId>451667</affiliateId> {truncated for brevity}
JSON 行程回复 - 日期范围
{
@size: "17",
customerSessionId: "0ABAAA35-7CC0-4914-85B2-C2517490798A",
Itinerary: { 1: {
itineraryId: 169435416,
affiliateId: 451667,
creationDate: "09/03/2014",
creationTime: "15:13:11 CDT",
itineraryStartDate: "10/03/2014",
itineraryEndDate: "10/05/2014",
Customer: {
email: "test@travelnow.com",
firstName: "test",
lastName: "tester",
homePhone: 2145370159,
workPhone: 2145370159,
CustomerAddresses: {
address1: "travelnow",
city: "Seattle",
stateProvinceCode: "WA",
countryCode: "US",
postalCode: 98004,
isPrimary: true,
type: 1
}
},
HotelConfirmation: {
supplierId: 13,
chainCode: "EP",
arrivalDate: "10/03/2014",
departureDate: "10/05/2014",
confirmationNumber: 1234,
RateInfos: {
@size: "1",
RateInfo: {
@priceBreakdown: "true",
@promo: "false",
@rateChange: "false",
ChargeableRateInfo: {
@averageBaseRate: "8941.0",
@averageRate: "8941.0",
@commissionableUsdTotal: "170.14",
@currencyCode: "JPY",
@maxNightlyRate: "8941.0",
@nightlyRateTotal: "17882.0",
@total: "17882.0",
NightlyRatesPerRoom: {
@size: "2",
NightlyRate: {
0: {
@baseRate: "8941.0",
@rate: "8941.0",
@promo: "false"
},
1: {
@baseRate: "8941.0",
@rate: "8941.0",
@promo: "false"
}
}
}
},
cancellationPolicy: "Ce montant ne peut être ni remboursé, ni modifié, ni annulé. Si vous décidez tout de même de modifier ou annuler cette réservation, vos paiements ne vous seront pas remboursés.",
nonRefundable: true,
online: true,
HotelFees: {
@size: "1",
HotelFee: {
@description: "MandatoryTax",
@amount: "1919"
}
},
rateType: "MerchantStandard"
}
},
numberOfAdults: 2,
numberOfChildren: 0,
smokingPreference: "N",
supplierPropertyId: 525133,
roomTypeCode: 176765,
rateCode: 1086015,
rateDescription: "Réservez tôt et économisez 14%",
roomDescription: "Chambre Double Standard",
status: "DT",
locale: "fr_FR",
ReservationGuest: {
firstName: "test",
lastName: "tester"
},
Hotel: {
hotelId: 113856,
statusCode: "A",
name: "Hotel BLOOM",
address1: "Rue Royale 250",
city: "Brussels",
countryCode: "BE",
postalCode: 1210,
phone: "32-22-206611",
fax: "32-22-178444",
latitude: 50.8552,
longitude: 4.36673,
coordinateAccuracyCode: 1,
lowRate: 154.7501,
highRate: 297.7253,
confidence: 88,
hotelRating: 4,
tripAdvisorRating: 4,
market: "Brussels, Belgium",
region: "Benelux",
superRegion: "EMEA",
theme: "Business Hotel"
},
nights: 2
}
},
2: {
itineraryId: 169502105,
affiliateId: 451667,
creationDate: "09/04/2014",
creationTime: "03:05:07 CDT", {truncated for brevity}



取消请求

没有仅针对取消请求或回复的更新。提供了示例用于比较。

SOAP 取消请求
<v3:getCancellation>
<HotelRoomCancellationRequest>
<apiKey>#####</apiKey>
<cid>#####</cid>
<customerIpAddress>xxx</customerIpAddress>
<customerSessionId>xxx</customerSessionId>
<customerUserAgent>xxx</customerUserAgent> <minorRev>##</minorRev>
<locale>en_US</locale>
<currencyCode>USD</currencyCode> <itineraryId>170009837</itineraryId>
<email>test@travelnow.com</email> <reason>COP</reason> <confirmationNumber>xxxxxxx</confirmationNumber>
</HotelRoomCancellationRequest>
</v3:getCancellation>
REST 取消请求
http://api.ean.com/ean-services/rs/hotel/v3/itin?
apiKey=#####
&cid=#####
&customerIpAddress=#####
&customerUserAgent=######
&customerSessionId=#####
&minorRev=##
&locale=en_US
&currencyCode=USD
&itineraryId=xxxxxxx
&email=email@domain.com
&reason=COP
&confirmationNumber=xxxxxxxx 
取消回复
SOAP 取消回复
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns1:getCancellationResponse xmlns:ns1="http://v3.hotel.wsapi.ean.com/">
         <HotelRoomCancellationResponse>
            <customerSessionId>XXXX</customerSessionId>
            <cancellationNumber>XXXXX</cancellationNumber>
         </HotelRoomCancellationResponse>
      </ns1:getCancellationResponse>
JSON 取消回复
{
   "HotelRoomCancellationResponse":{
      "customerSessionId":"XXXX",
      "cancellationNumber":"XXXXX"
   }
}