预订宝/getHotelRooms

来自站长百科
跳转至: 导航、​ 搜索

预订宝 | 系统设置 | 后台管理 |二次开发

getHotelRooms概述[ ]

  • 接口地址:http://api.yudingbao.net/v1.0/hotel/search.ashx?act=getHotelRooms
  • 动作标识:getHotelRooms
  • 参数:见参数说明
  • 请求方式:GET
  • 响应模式:JSONJSONPXML

注意:动作标识是大小写敏感的,请养成良好的编码习惯。

参数说明[ ]

参数名称 参数类型 说明
1 hotelCode string 酒店编号。每次仅允许查询1个酒店。
2 checkInDate date 入住日期。该参数是必填的。日期格式如为“yyyy-MM-dd”。
3 checkOutDate date 退房日期。该参数是必填的。日期格式如为“yyyy-MM-dd”。
4 lowestPrice double 最低房价。如设定此参数的值,则低于该值的房价排期将不会被列出。
该参数是可选的。默认为0,即不限制。
5 highestPrice double 最高房价。如设定次参数的值,则高于该值的房价排期将不会被列出。
该参数是可选的。默认为0,即不限制。
6 broadbandService int 宽带服务。该参数是可选的。宽带服务参数的定义如下:
0 —— 不限制。
1 —— 收费。提供上网服务,但要收费。
2 —— 免费。免费提供上网服务。
7 includeNonBooking bool 指示响应结果是否应当包含不可预订的酒店或房间。
该参数是可选的。默认为true。
8 includeGuaranteeable bool 指示响应结果是否应当包含需要担保才能入住的酒店或房间。
该参数是可选的。默认为true。

数据格式[ ]

  • 响应头:
    • Status:0为正常,非0表示处理请求时发生异常,通常是参数校验错误;
    • Messages:当Status为非0时该字段肯定包含一条或多条消息文本;
  • 响应体:

酒店信息中可能出现以下几个置换符,调用数据时应当做相应处理:

替代符标签 说明
1 {$Website.Domain$} 应当替换为您自己网站的域名
2 {$Website.Name$} 应当替换为您自己的网站名。

注意:本接口的XML响应体的酒店数据之下的Landmarks节点的内容带有命名空间,解析时请注意!

对于数据格式的理解,请参考下列示例代码中的XML响应演示,其中每个字段都标注了数据类型(日期类型在XML响应中统一使用GMT格式,但被标注为string,请开发者注意)。

示例代码[ ]

以下示例代码是通过HTML表单实现了该接口的部分操作,您在开发过程中应当使用自己的平台语言来模拟这些操作以捕获响应体,然后对响应体做出相应的操作。

请求示例

<!--
    这是该接口的请求示例,该接口的访问类同于如下表单的提交,
     
    请注意:该表单使用控件的方法模拟了GET请求
-->
<form id="myForm" method="get" action="http://api.yudingbao.net/v1.0/hotel/search.ashx" target="_blank">
    <p>
        <!--动作标识,注意动作标识是大小写敏感的-->
        <input id="act" name="act" value="getHotelRooms" type="text" />
    </p>
    <p>
        <input id="hotelCode" name="hotelCode" value="h010t50501006" type="text">
        <input id="checkInDate" name="checkInDate" value="2011-05-27" type="text">
        <input id="checkOutDate" name="checkOutDate" value="2011-06-02" type="text">
        <input id="lowestPrice" name="lowestPrice" value="0" type="text">
        <input id="highestPrice" name="highestPrice" value="0" type="text">
        <input id="broadbandService" name="broadbandService" value="0" type="text">
        <input id="includeNonBooking" name="includeNonBooking" value="true" type="text">
        <input id="includeGuaranteeable" name="includeGuaranteeable" value="true" type="text">
    </p>
    <p>
        <!--指定响应格式为XML,这里以XML为例-->
        <input id="format" name="format" value="xml" type="text" />
        <!--指定响应体应当是已格式化的,便于阅读代码,在生产环境中应当将该值设置为false-->
        <input id="indent" name="indent" value="true" type="text" />
        <!--产品编号。在我的账户-分销产品的应用列表中可以找到该参数的值。-->
        <input id="aid" name="aid" value="78663" type="text" />
        <!--接口密钥。在我的账户-分销产品的应用列表中可以找到该参数的值。-->
        <input id="key" name="key" value="0925ed633d24577eb3ffe13f00c55a4f9739f51a77eefb1dba29bb9568acddfd" type="text" />
         
        <!--应用程序授权编号及公钥,这是可选的-->
        <input id="sid" name="sid" value="" type="text">      
        <input id="sKey" name="sKey" value="" type="text">
    </p>
    <p>
        <input id="submit" name="submit" value="提交" type="submit">
    </p>
</form>

XML响应

<!--XML响应,响应体过大,已删节-->
<?xml version="1.0" encoding="utf-8"?>
<HttpResponse>
    <Status type="number">0</Status>
    <Messages type="array">
    </Messages>
    <ResponseBody type="array">
        <item type="object">
            <TypeId type="string">0002</TypeId>
            <Name type="string">豪华间</Name>
            <Broadband type="number">2</Broadband>
            <TypeNumber type="number">120</TypeNumber>
            <Area type="number">45</Area>
            <Floor type="string">5-16</Floor>
            <BedDescription type="string">大床,双床,收费上网,宽带,</BedDescription>
            <Note type="string">
            </Note>
            <RatePlans type="array">
                <item type="object">
                    <_id type="number">88657</_id>
                    <Name type="string">不含早(连住2晚起)</Name>
                    <Rates type="array">
                        <item type="object">
                            <Date type="string">Sun, 01 Jun 0042 00:00:00 GMT</Date>
                            <RetailRate type="number">0.0</RetailRate>
                            <MemberRate type="number">0.0</MemberRate>
                            <AddBedRate type="number">0.0</AddBedRate>
                            <CanBook type="boolean">false</CanBook>
                        </item>
                        <item type="object">
                            <Date type="string">Mon, 02 Jun 0042 00:00:00 GMT</Date>
                            <RetailRate type="number">0.0</RetailRate>
                            <MemberRate type="number">0.0</MemberRate>
                            <AddBedRate type="number">0.0</AddBedRate>
                            <CanBook type="boolean">false</CanBook>
                        </item>
                    </Rates>
                    <TotalPrice type="number">0.0</TotalPrice>
                    <LowestPrice type="number">0.0</LowestPrice>
                    <HighestPrice type="number">0.0</HighestPrice>
                    <AveragePrice type="number">0.0</AveragePrice>
                    <NonBookingPercentage type="number">100.0</NonBookingPercentage>
                    <IsGuaranteeable type="boolean">false</IsGuaranteeable>
                    <GaranteeRules type="array">
                    </GaranteeRules>
                </item>
                <item type="object">
                    <_id type="number">109009</_id>
                    <Name type="string">不含早(促销价)</Name>
                    <Rates type="array">
                        <item type="object">
                            <Date type="string">Sun, 01 Jun 0042 00:00:00 GMT</Date>
                            <RetailRate type="number">0.0</RetailRate>
                            <MemberRate type="number">0.0</MemberRate>
                            <AddBedRate type="number">0.0</AddBedRate>
                            <CanBook type="boolean">false</CanBook>
                        </item>
                        <item type="object">
                            <Date type="string">Mon, 02 Jun 0042 00:00:00 GMT</Date>
                            <RetailRate type="number">0.0</RetailRate>
                            <MemberRate type="number">0.0</MemberRate>
                            <AddBedRate type="number">0.0</AddBedRate>
                            <CanBook type="boolean">false</CanBook>
                        </item>
                    </Rates>
                    <TotalPrice type="number">0.0</TotalPrice>
                    <LowestPrice type="number">0.0</LowestPrice>
                    <HighestPrice type="number">0.0</HighestPrice>
                    <AveragePrice type="number">0.0</AveragePrice>
                    <NonBookingPercentage type="number">100.0</NonBookingPercentage>
                    <IsGuaranteeable type="boolean">false</IsGuaranteeable>
                    <GaranteeRules type="array">
                    </GaranteeRules>
                </item>
            </RatePlans>
        </item>
        <item type="object">
            <TypeId type="string">0010</TypeId>
            <Name type="string">特色套房</Name>
            <Broadband type="number">2</Broadband>
            <TypeNumber type="number">10</TypeNumber>
            <Area type="number">86</Area>
            <Floor type="string">
            </Floor>
            <BedDescription type="string">大床,收费上网,宽带,</BedDescription>
            <Note type="string">
            </Note>
            <RatePlans type="array">
                <item type="object">
                    <_id type="number">88657</_id>
                    <Name type="string">不含早(连住2晚起)</Name>
                    <Rates type="array">
                        <item type="object">
                            <Date type="string">Sun, 01 Jun 0042 00:00:00 GMT</Date>
                            <RetailRate type="number">0.0</RetailRate>
                            <MemberRate type="number">0.0</MemberRate>
                            <AddBedRate type="number">0.0</AddBedRate>
                            <CanBook type="boolean">false</CanBook>
                        </item>
                        <item type="object">
                            <Date type="string">Mon, 02 Jun 0042 00:00:00 GMT</Date>
                            <RetailRate type="number">0.0</RetailRate>
                            <MemberRate type="number">0.0</MemberRate>
                            <AddBedRate type="number">0.0</AddBedRate>
                            <CanBook type="boolean">false</CanBook>
                        </item>
                    </Rates>
                    <TotalPrice type="number">0.0</TotalPrice>
                    <LowestPrice type="number">0.0</LowestPrice>
                    <HighestPrice type="number">0.0</HighestPrice>
                    <AveragePrice type="number">0.0</AveragePrice>
                    <NonBookingPercentage type="number">100.0</NonBookingPercentage>
                    <IsGuaranteeable type="boolean">false</IsGuaranteeable>
                    <GaranteeRules type="array">
                    </GaranteeRules>
                </item>
                <item type="object">
                    <_id type="number">109009</_id>
                    <Name type="string">不含早(促销价)</Name>
                    <Rates type="array">
                        <item type="object">
                            <Date type="string">Sun, 01 Jun 0042 00:00:00 GMT</Date>
                            <RetailRate type="number">0.0</RetailRate>
                            <MemberRate type="number">0.0</MemberRate>
                            <AddBedRate type="number">0.0</AddBedRate>
                            <CanBook type="boolean">false</CanBook>
                        </item>
                        <item type="object">
                            <Date type="string">Mon, 02 Jun 0042 00:00:00 GMT</Date>
                            <RetailRate type="number">0.0</RetailRate>
                            <MemberRate type="number">0.0</MemberRate>
                            <AddBedRate type="number">0.0</AddBedRate>
                            <CanBook type="boolean">false</CanBook>
                        </item>
                    </Rates>
                    <TotalPrice type="number">0.0</TotalPrice>
                    <LowestPrice type="number">0.0</LowestPrice>
                    <HighestPrice type="number">0.0</HighestPrice>
                    <AveragePrice type="number">0.0</AveragePrice>
                    <NonBookingPercentage type="number">100.0</NonBookingPercentage>
                    <IsGuaranteeable type="boolean">false</IsGuaranteeable>
                    <GaranteeRules type="array">
                    </GaranteeRules>
                </item>
            </RatePlans>
        </item>
    </ResponseBody>
</HttpResponse>

JSON响应

// Json响应,响应体过大,已删节
{
    "Status" : 0,
    "Messages" : [],
    "ResponseBody" : [{
            "TypeId" : "0002",
            "Name" : "豪华间",
            "Broadband" : 2,
            "TypeNumber" : 120,
            "Area" : 45,
            "Floor" : "5-16",
            "BedDescription" : "大床,双床,收费上网,宽带,",
            "Note" : "",
            "RatePlans" : [{
                    "_id" : 88657,
                    "Name" : "不含早(连住2晚起)",
                    "Rates" : [{
                            "Date" : Date(1306886400000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }, {
                            "Date" : Date(1306972800000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }],
                    "TotalPrice" : 0.0,
                    "LowestPrice" : 0.0,
                    "HighestPrice" : 0.0,
                    "AveragePrice" : 0.0,
                    "NonBookingPercentage" : 100.0,
                    "IsGuaranteeable" : false,
                    "GaranteeRules" : []
                }, {
                    "_id" : 109009,
                    "Name" : "不含早(促销价)",
                    "Rates" : [{
                            "Date" : Date(1306886400000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }, {
                            "Date" : Date(1306972800000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }],
                    "TotalPrice" : 0.0,
                    "LowestPrice" : 0.0,
                    "HighestPrice" : 0.0,
                    "AveragePrice" : 0.0,
                    "NonBookingPercentage" : 100.0,
                    "IsGuaranteeable" : false,
                    "GaranteeRules" : []
                }]
        }, {
            "TypeId" : "0003",
            "Name" : "金尊费尔蒙房",
            "Broadband" : 2,
            "TypeNumber" : 18,
            "Area" : 45,
            "Floor" : "17-23",
            "BedDescription" : "大床,收费上网,宽带,",
            "Note" : "有无烟房",
            "RatePlans" : [{
                    "_id" : 109019,
                    "Name" : "含双早(促销价)",
                    "Rates" : [{
                            "Date" : Date(1306886400000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }, {
                            "Date" : Date(1306972800000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }],
                    "TotalPrice" : 0.0,
                    "LowestPrice" : 0.0,
                    "HighestPrice" : 0.0,
                    "AveragePrice" : 0.0,
                    "NonBookingPercentage" : 100.0,
                    "IsGuaranteeable" : false,
                    "GaranteeRules" : []
                }]
        }]
}

JSONP响应

// JsonP响应,响应体过大,已删节
jsoncallback({
    "Status" : 0,
    "Messages" : [],
    "ResponseBody" : [{
            "TypeId" : "0002",
            "Name" : "豪华间",
            "Broadband" : 2,
            "TypeNumber" : 120,
            "Area" : 45,
            "Floor" : "5-16",
            "BedDescription" : "大床,双床,收费上网,宽带,",
            "Note" : "",
            "RatePlans" : [{
                    "_id" : 88657,
                    "Name" : "不含早(连住2晚起)",
                    "Rates" : [{
                            "Date" : Date(1306886400000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }, {
                            "Date" : Date(1306972800000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }],
                    "TotalPrice" : 0.0,
                    "LowestPrice" : 0.0,
                    "HighestPrice" : 0.0,
                    "AveragePrice" : 0.0,
                    "NonBookingPercentage" : 100.0,
                    "IsGuaranteeable" : false,
                    "GaranteeRules" : []
                }, {
                    "_id" : 109009,
                    "Name" : "不含早(促销价)",
                    "Rates" : [{
                            "Date" : Date(1306886400000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }, {
                            "Date" : Date(1306972800000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }],
                    "TotalPrice" : 0.0,
                    "LowestPrice" : 0.0,
                    "HighestPrice" : 0.0,
                    "AveragePrice" : 0.0,
                    "NonBookingPercentage" : 100.0,
                    "IsGuaranteeable" : false,
                    "GaranteeRules" : []
                }]
        }, {
            "TypeId" : "0003",
            "Name" : "金尊费尔蒙房",
            "Broadband" : 2,
            "TypeNumber" : 18,
            "Area" : 45,
            "Floor" : "17-23",
            "BedDescription" : "大床,收费上网,宽带,",
            "Note" : "有无烟房",
            "RatePlans" : [{
                    "_id" : 109019,
                    "Name" : "含双早(促销价)",
                    "Rates" : [{
                            "Date" : Date(1306886400000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }, {
                            "Date" : Date(1306972800000),
                            "RetailRate" : 0.0,
                            "MemberRate" : 0.0,
                            "AddBedRate" : 0.0,
                            "CanBook" : false
                        }],
                    "TotalPrice" : 0.0,
                    "LowestPrice" : 0.0,
                    "HighestPrice" : 0.0,
                    "AveragePrice" : 0.0,
                    "NonBookingPercentage" : 100.0,
                    "IsGuaranteeable" : false,
                    "GaranteeRules" : []
                }]
        }]
});


参考来源[ ]

预订宝酒店预订网站系统使用手册导航

系统设置: 网站参数设置|图片功能设置|会员参数设置|有问必 答(论坛留言)设置|发布设置|首页默认城市设置
后台管理 客服设置|权限组管理|系统账户设置|个人设置|酒店 资讯|实用工具|网址导航|首页广告|会展信息|单页图 文|发布模型管理|分类管理|推荐属性管理|SEO关键字管理

评论管理|有问必答|会员管理|等级管理|酒店订单管理|手机推广终端

二次开发 API总体架构|鉴权方式|酒店地理信息API|酒店基础信息API酒店房价与房态API|酒店订单API|IP地址归属地查询系统|手机短信API|getRegions|getCity

getLandmarks|getHotelIdList|getHotelInfo|getHotelChainBrands|getHotelList|getHotelRooms|getHotelSummaryList|getOrderRoomStatus|submitOrder getOrderInfo|sendRegisterSMS|sendGetpassSMS|sendPromoteRegisterSMS