ShowAPI,自营为主的数据交易市场
立即注册

酒店查询预定接口

提供者: 易源官方 部分收费

合作方为携程集团同程网。根据城市、区域、坐标等查询酒店和进行预订。

浏览量:39368

调用量:1477812866

使用人数:26743

点赞:70

申请使用 查看演示
文档 授权签名(重要) 联系信息 价格一览表 接口演示
接入点列表
全国酒店省份id查询
根据省份查询城市id
根据城市id查询行政区
酒店查询
根据名称查询行政区
酒店预订
酒店价格查询
数据结构列表
Province
Hotel
HotelPrice
HotelRoom
PricePolicy
资源列表
·SDK及代码示例
规则中心
·名词解释
·常见问题

请求URL地址

http://route.showapi.com/405-1
注意:接口支持https,更安全,但稍慢一些,你懂的。请根据自己的情况进行选择。

请求参数

HTTP协议,支持GET/POST方法。
非文件上传的POST时,enctype=application/x-www-form-urlencoded。
文件上传的POST时,enctype=multipart/form-data。
1.系统级参数(所有接入点都需要的参数):+点此展开
2.应用级参数(每个接入点有自己的参数):
参数名称 类型 默认值 示例值 必须 描述

返回参数

以JSON格式返回结果。
1.系统级参数(所有接入点都会返回的参数):+点此展开
2.应用级参数(系统级输出参数showapi_res_body字段中的json数据结构):
名称 类型 示例值 描述
list Province[] 省份列表
- id String 3 id
- enName String BeiJing 英文名
- name String 北京 中文名
- prefixLetter String B 名字前缀
  • 请求实例
  • java_sdk
  • 纯java
  • curl
  • php
  • android
  • python
String res=new ShowApiRequest("http://route.showapi.com/405-1","my_appId","my_appSecret")
           .post();
System.out.println(res);

                  public static void main(String path[]) throws Exception {
									URL u=new URL("http://route.showapi.com/405-1?showapi_appid=myappid&showapi_sign=mysecret");
									InputStream in=u.openStream();
									ByteArrayOutputStream out=new ByteArrayOutputStream();
									try {
										byte buf[]=new byte[1024];
										int read = 0;
										while ((read = in.read(buf)) > 0) {
											out.write(buf, 0, read);
										}
									}  finally {
										if (in != null) {
											in.close();
										}
									}
									byte b[]=out.toByteArray( );
									System.out.println(new String(b,"utf-8"));
							}
						 
						
						//字段值为中文、空格、特殊符号的地方需要做urlencode,编码为utf-8。用js的方式就是:
						//encodeURIComponent('中文')
						//比如"中文"转换后就是%25E4%25B8%25AD%25E6%2596%2587
            curl   "http://route.showapi.com/405-1?showapi_appid=123&showapi_sign=use_my_sign&"
						
						 //md5签名方式--非简单签名
               			<?php
							header("Content-Type:text/html;charset=UTF-8");
							date_default_timezone_set("PRC");
							$showapi_appid = 'xxxxxx';  //替换此值,在官网的"我的应用"中找到相关值
							$showapi_secret = 'xxxxxxxxx';  //替换此值,在官网的"我的应用"中找到相关值 
							$paramArr = array(
							     'showapi_appid'=> $showapi_appid
							     //添加其他参数
							);
							
							//创建参数(包括签名的处理)
							function createParam ($paramArr,$showapi_secret) {
							     $paraStr = "";
							     $signStr = "";
							     ksort($paramArr);
							     foreach ($paramArr as $key => $val) {
							         if ($key != '' && $val != '') {
							             $signStr .= $key.$val;
							             $paraStr .= $key.'='.urlencode($val).'&';
							         }
							     }
							     $signStr .= $showapi_secret;//排好序的参数加上secret,进行md5
							     $sign = strtolower(md5($signStr));
							     $paraStr .= 'showapi_sign='.$sign;//将md5后的值作为参数,便于服务器的效验
							     echo "排好序的参数:".$signStr."
\r\n"; return $paraStr; } $param = createParam($paramArr,$showapi_secret); $url = 'http://route.showapi.com/405-1?'.$param; echo "请求的url:".$url."
\r\n"; $result = file_get_contents($url); echo "返回的json数据:
\r\n"; print $result.'
\r\n'; $result = json_decode($result); echo "
\r\n取出showapi_res_code的值:
\r\n"; print_r($result->showapi_res_code); echo "
\r\n"; ?>
						//以下代码为纯java实现,并未依赖第三方框架,具体传入参数请参看接口描述详情页.
						protected Handler mHandler =  new Handler();
						protected void onCreate(Bundle savedInstanceState) {
								super.onCreate(savedInstanceState);
								setContentView(R.layout.activity_main);
								final TextView txt = (TextView) this.findViewById(R.id.textView1);
								Button myBtn = (Button) this.findViewById(R.id.button1);
								myBtn.setOnClickListener(new OnClickListener() {
									public void onClick(View v) {
										new Thread(){
											//在新线程中发送网络请求
											public void run() {
												String appid="xxx";//要替换成自己的
												String secret="xxxxxxx";//要替换成自己的
												final String res=new ShowApiRequest( "http://route.showapi.com/405-1", appid, secret)
.post();
												
												System.out.println(res);
												//把返回内容通过handler对象更新到界面
												mHandler.post(new Thread(){
													public void run() {
														txt.setText(res+"  "+new Date());
													}
												});
											}
										}.start();
										
										
									}
								});
						}

						
#python3.5
from urllib import    request, parse
import json

print('send data....')
showapi_appid="xxxxxxxxxx"  #替换此值
showapi_sign="xxxxxxxxxx"   #替换此值
url="http://route.showapi.com/405-1"
send_data = parse.urlencode([
    ('showapi_appid', showapi_appid)
    ,('showapi_sign', showapi_sign)
    
  ])

req = request.Request(url)
try:
       response = request.urlopen(req, data=send_data.encode('utf-8'), timeout = 10) # 10秒超时反馈
except Exception as e:
    print(e)
result = response.read().decode('utf-8')
result_json = json.loads(result)
print ('result_json data is:', result_json)

						

返回实例

{
	"showapi_res_code": 0,
	"showapi_res_error": "",
	"showapi_res_body": {
		"list": [
			{
				"enName": "AnHui",
				"id": "2",
				"name": "安徽",
				"prefixLetter": "A"
			},
			{
				"enName": "BeiJing",
				"id": "3",
				"name": "北京",
				"prefixLetter": "B"
			},
			{
				"enName": "FuJian",
				"id": "4",
				"name": "福建",
				"prefixLetter": "F"
			},
			{
				"enName": "GanSu",
				"id": "5",
				"name": "甘肃",
				"prefixLetter": "G"
			},
			{
				"enName": "GuangDong",
				"id": "6",
				"name": "广东",
				"prefixLetter": "G"
			},
			{
				"enName": "GuangXi",
				"id": "7",
				"name": "广西",
				"prefixLetter": "G"
			},
			{
				"enName": "GuiZhou",
				"id": "8",
				"name": "贵州",
				"prefixLetter": "G"
			},
			{
				"enName": "HaiNan",
				"id": "9",
				"name": "海南",
				"prefixLetter": "H"
			},
			{
				"enName": "HeBei",
				"id": "10",
				"name": "河北",
				"prefixLetter": "H"
			},
			{
				"enName": "HeNan",
				"id": "11",
				"name": "河南",
				"prefixLetter": "H"
			},
			{
				"enName": "HeiLongJiang",
				"id": "12",
				"name": "黑龙江",
				"prefixLetter": "H"
			},
			{
				"enName": "HuBei",
				"id": "13",
				"name": "湖北",
				"prefixLetter": "H"
			},
			{
				"enName": "HuNan",
				"id": "14",
				"name": "湖南",
				"prefixLetter": "H"
			},
			{
				"enName": "JiLin",
				"id": "15",
				"name": "吉林",
				"prefixLetter": "J"
			},
			{
				"enName": "JiangSu",
				"id": "16",
				"name": "江苏",
				"prefixLetter": "J"
			},
			{
				"enName": "JiangXi",
				"id": "17",
				"name": "江西",
				"prefixLetter": "J"
			},
			{
				"enName": "LiaoNing",
				"id": "18",
				"name": "辽宁",
				"prefixLetter": "L"
			},
			{
				"enName": "NeiMengGu",
				"id": "19",
				"name": "内蒙古",
				"prefixLetter": "N"
			},
			{
				"enName": "NingXia",
				"id": "20",
				"name": "宁夏",
				"prefixLetter": "N"
			},
			{
				"enName": "QingHai",
				"id": "21",
				"name": "青海",
				"prefixLetter": "Q"
			},
			{
				"enName": "ShanDong",
				"id": "22",
				"name": "山东",
				"prefixLetter": "S"
			},
			{
				"enName": "ShanXi",
				"id": "23",
				"name": "山西",
				"prefixLetter": "S"
			},
			{
				"enName": "ShanXi",
				"id": "24",
				"name": "陕西",
				"prefixLetter": "S"
			},
			{
				"enName": "ShangHai",
				"id": "25",
				"name": "上海",
				"prefixLetter": "S"
			},
			{
				"enName": "SiChuan",
				"id": "26",
				"name": "四川",
				"prefixLetter": "S"
			},
			{
				"enName": "TianJin",
				"id": "27",
				"name": "天津",
				"prefixLetter": "T"
			},
			{
				"enName": "Tibet",
				"id": "28",
				"name": "西藏",
				"prefixLetter": "X"
			},
			{
				"enName": "XinJiang",
				"id": "29",
				"name": "新疆",
				"prefixLetter": "X"
			},
			{
				"enName": "YunNan",
				"id": "30",
				"name": "云南",
				"prefixLetter": "Y"
			},
			{
				"enName": "ZheJiang",
				"id": "31",
				"name": "浙江",
				"prefixLetter": "Z"
			},
			{
				"enName": "ChongQing",
				"id": "32",
				"name": "重庆",
				"prefixLetter": "C"
			},
			{
				"enName": "Hong Kong",
				"id": "33",
				"name": "香港",
				"prefixLetter": "X"
			},
			{
				"enName": "Macao",
				"id": "34",
				"name": "澳门",
				"prefixLetter": "A"
			},
			{
				"enName": "Taiwan",
				"id": "35",
				"name": "台湾",
				"prefixLetter": "T"
			}
		],
		"ret_code": 0
	}
}




请求地址 请求参数 返回参数 请求示例 返回示例
接入点列表
全国酒店省份id查询
根据省份查询城市id
根据城市id查询行政区
酒店查询
根据名称查询行政区
酒店预订
酒店价格查询
  • 免费套餐(全国酒店省份id查询)

免费套餐_无认证版

0时间:1年

  • 不限调用次数
  • 1次/秒调用频率
  •  
  •  
点此订购

免费套餐_基本认证版

0时间:1年

  • 不限调用次数
  • 2次/秒调用频率
  • 邮箱认证 要求
  • 手机认证 要求
点此订购

免费套餐_实名认证版

0时间:1年

  • 不限调用次数
  • 3次/秒调用频率
  • 邮箱认证 要求
  • 手机认证 要求
  • 实名认证 要求
点此订购