预订宝/getCity

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

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

getCity概述[ ]

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

参数说明[ ]

参数名称 参数类型 说明
cityCode string 城市编号。
includeDistricts bool 指示响应结果应当包含城市内的行政区或县。默认值为true。
includeCommercials bool 指示响应结果应当包含城市内的热门商业区的集合。默认值为true。
includeLandmarks bool 指示响应结果应当包含成好似内的著名地标的集合。默认值为true。

数据格式[ ]

  • 响应头:
    • Status:0为正常,非0表示处理请求时发生异常,通常是参数校验错误;
    • Messages:当Status为非0时该字段肯定包含一条或多条消息文本;
  • 响应体:
    • 地理位置信息包含编号、名称和拼音三个基本属性;
    • 城市下可能包含多个行政区(DistrictLocations)、商业区(CommercialLocations)和著名地标(LandmarkLocations);
    • 另外城市下还包含一个TotalHotels属性,该属性表示该城市内的签约酒店总数;

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

示例代码[ ]

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


请求示例:

<!--
    这是该接口的请求示例,该接口的访问类同于如下表单的提交,
     
    请注意:该表单使用控件的方法模拟了GET请求
-->
<form id="myForm" method="get" action="http://api.yudingbao.net/v1.0/hotel/geospatials.ashx">
    <p>
        <!--动作标识,注意动作标识是大小写敏感的-->
        <input id="act" name="act" value="getCity" type="text" />
    </p>
    <p>
        <!--城市编号,0101是北京的编号-->
        <input id="cityCode" name="cityCode" value="0101" type="text" />
        <!--指定响应结果应包含行政区数据-->
        <input id="includeDistricts" name="withDistricts" value="true" type="text" />
        <!--指定响应结果应包含商业区数据-->
        <input id="includeCommercials" name="withCommercials" value="true" type="text" />
        <!--指定响应结果应包含著名地标数据-->
        <input id="includeLandmarks" name="withLandmarks" 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="object">
        <Code type="string">0101</Code>
        <Name type="string">北京</Name>
        <Pinyin type="string">
        </Pinyin>
        <TotalHotels type="number">1388</TotalHotels>
        <DistrictLocations type="array">
            <item type="object">
                <Code type="string">0001</Code>
                <Name type="string">西城区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0002</Code>
                <Name type="string">东城区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0003</Code>
                <Name type="string">朝阳区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0004</Code>
                <Name type="string">宣武区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0005</Code>
                <Name type="string">崇文区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0006</Code>
                <Name type="string">丰台区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0009</Code>
                <Name type="string">石景山区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0011</Code>
                <Name type="string">海淀区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0024</Code>
                <Name type="string">密云县</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0025</Code>
                <Name type="string">顺义区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0026</Code>
                <Name type="string">延庆县</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0027</Code>
                <Name type="string">通州区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0028</Code>
                <Name type="string">昌平区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0029</Code>
                <Name type="string">怀柔区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0030</Code>
                <Name type="string">平谷区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0031</Code>
                <Name type="string">门头沟区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0032</Code>
                <Name type="string">房山区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0033</Code>
                <Name type="string">大兴区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
        </DistrictLocations>
        <CommercialLocations type="array">
            <item type="object">
                <Code type="string">010101</Code>
                <Name type="string">国贸CBD</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">010102</Code>
                <Name type="string">燕莎/农展馆</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">010103</Code>
                <Name type="string">王府井商业区</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
        </CommercialLocations>
        <LandmarkLocations type="array">
            <item type="object">
                <Code type="string">0005</Code>
                <Name type="string">东方广场</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
            <item type="object">
                <Code type="string">0006</Code>
                <Name type="string">中国国际展览中心</Name>
                <Pinyin type="string">
                </Pinyin>
            </item>
        </LandmarkLocations>
    </ResponseBody>
</HttpResponse>


JSON响应:

// Json响应,响应体过大,已删节
{
    "Status" : 0,
    "Messages" : [],
    "ResponseBody" : {
        "Code" : "0101",
        "Name" : "北京",
        "Pinyin" : "",
        "TotalHotels" : 1388,
        "DistrictLocations" : [{
                "Code" : "0001",
                "Name" : "西城区",
                "Pinyin" : ""
            }, {
                "Code" : "0002",
                "Name" : "东城区",
                "Pinyin" : ""
            }, {
                "Code" : "0003",
                "Name" : "朝阳区",
                "Pinyin" : ""
            }, {
                "Code" : "0004",
                "Name" : "宣武区",
                "Pinyin" : ""
            }, {
                "Code" : "0005",
                "Name" : "崇文区",
                "Pinyin" : ""
            }, {
                "Code" : "0006",
                "Name" : "丰台区",
                "Pinyin" : ""
            }, {
                "Code" : "0009",
                "Name" : "石景山区",
                "Pinyin" : ""
            }, {
                "Code" : "0011",
                "Name" : "海淀区",
                "Pinyin" : ""
            }, {
                "Code" : "0024",
                "Name" : "密云县",
                "Pinyin" : ""
            }, {
                "Code" : "0025",
                "Name" : "顺义区",
                "Pinyin" : ""
            }, {
                "Code" : "0026",
                "Name" : "延庆县",
                "Pinyin" : ""
            }, {
                "Code" : "0027",
                "Name" : "通州区",
                "Pinyin" : ""
            }, {
                "Code" : "0028",
                "Name" : "昌平区",
                "Pinyin" : ""
            }, {
                "Code" : "0029",
                "Name" : "怀柔区",
                "Pinyin" : ""
            }, {
                "Code" : "0030",
                "Name" : "平谷区",
                "Pinyin" : ""
            }, {
                "Code" : "0031",
                "Name" : "门头沟区",
                "Pinyin" : ""
            }, {
                "Code" : "0032",
                "Name" : "房山区",
                "Pinyin" : ""
            }, {
                "Code" : "0033",
                "Name" : "大兴区",
                "Pinyin" : ""
            }],
        "CommercialLocations" : [{
                "Code" : "010101",
                "Name" : "国贸CBD",
                "Pinyin" : ""
            }, {
                "Code" : "010102",
                "Name" : "燕莎/农展馆",
                "Pinyin" : ""
            }, {
                "Code" : "010103",
                "Name" : "王府井商业区",
                "Pinyin" : ""
            }],
        "LandmarkLocations" : [{
                "Code" : "0005",
                "Name" : "东方广场",
                "Pinyin" : ""
            }, {
                "Code" : "0006",
                "Name" : "中国国际展览中心",
                "Pinyin" : ""
            }]
    }
}


JSONP响应:

// JsonP响应,响应体过大,已删节
jsoncallback({
    "Status" : 0,
    "Messages" : [],
    "ResponseBody" : {
        "Code" : "0101",
        "Name" : "北京",
        "Pinyin" : "",
        "TotalHotels" : 1388,
        "DistrictLocations" : [{
                "Code" : "0001",
                "Name" : "西城区",
                "Pinyin" : ""
            }, {
                "Code" : "0002",
                "Name" : "东城区",
                "Pinyin" : ""
            }, {
                "Code" : "0003",
                "Name" : "朝阳区",
                "Pinyin" : ""
            }, {
                "Code" : "0004",
                "Name" : "宣武区",
                "Pinyin" : ""
            }, {
                "Code" : "0005",
                "Name" : "崇文区",
                "Pinyin" : ""
            }, {
                "Code" : "0006",
                "Name" : "丰台区",
                "Pinyin" : ""
            }, {
                "Code" : "0009",
                "Name" : "石景山区",
                "Pinyin" : ""
            }, {
                "Code" : "0011",
                "Name" : "海淀区",
                "Pinyin" : ""
            }, {
                "Code" : "0024",
                "Name" : "密云县",
                "Pinyin" : ""
            }, {
                "Code" : "0025",
                "Name" : "顺义区",
                "Pinyin" : ""
            }, {
                "Code" : "0026",
                "Name" : "延庆县",
                "Pinyin" : ""
            }, {
                "Code" : "0027",
                "Name" : "通州区",
                "Pinyin" : ""
            }, {
                "Code" : "0028",
                "Name" : "昌平区",
                "Pinyin" : ""
            }, {
                "Code" : "0029",
                "Name" : "怀柔区",
                "Pinyin" : ""
            }, {
                "Code" : "0030",
                "Name" : "平谷区",
                "Pinyin" : ""
            }, {
                "Code" : "0031",
                "Name" : "门头沟区",
                "Pinyin" : ""
            }, {
                "Code" : "0032",
                "Name" : "房山区",
                "Pinyin" : ""
            }, {
                "Code" : "0033",
                "Name" : "大兴区",
                "Pinyin" : ""
            }],
        "CommercialLocations" : [{
                "Code" : "010101",
                "Name" : "国贸CBD",
                "Pinyin" : ""
            }, {
                "Code" : "010102",
                "Name" : "燕莎/农展馆",
                "Pinyin" : ""
            }, {
                "Code" : "010103",
                "Name" : "王府井商业区",
                "Pinyin" : ""
            }],
        "LandmarkLocations" : [{
                "Code" : "0005",
                "Name" : "东方广场",
                "Pinyin" : ""
            }, {
                "Code" : "0006",
                "Name" : "中国国际展览中心",
                "Pinyin" : ""
            }]
    }
});


参考来源[ ]

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

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

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

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

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