全国房产信息
万维易源 官方文档
搜索最新楼盘开盘信息、最新市场房价信息
基本说明:
接口地址:http://route.showapi.com/1610-1
返回格式:json
请求方式:get/post
请求示例:0
请求参数说明:
名称 类型 必填 说明
cityName String 必填 城市名字
hourseName String 选填 楼盘名字
page String 选填 页码
返回参数说明:
名称 类型 说明
ret_code String 0为成功,其余为失败
result String 返回信息
hourseName String 楼盘名字
hourseLocal String 楼盘位置
uildYear String 建立年代
uildType String 楼盘类型
hourseCount String 房屋总数
uildingCount String 楼栋总数
ropertyCompany String 物业公司
developer String 开发商
econdarySource String 二手房源
recentDeal String 最近成交
monthPrice String 每月均价
JSON返回示例:
{
	"showapi_res_code": 0,
	"showapi_res_error": "",
	"showapi_res_body": {
		"result": {
			"allPages": 39,
			"contentlist": [{
				"buildType": "板楼",
				"hourseType": "住宅",
				"imgList": [
					"http://img1.soufun.com/house/images/shequ_detail_201708/default_b.jpg"
				],
				"hourseLocal": "官南大道北段锦苑花园旁",
				"hourseName": "劳务局宿舍",
				"hourseId": "8ff42d51185a46ccbb87332a3d5bb5ba",
				"hourseCount": "70户",
				"cityName": "昆明",
				"monthPrice": "8069",
				"buildYear": "1900年建成"
			}],
			"currentPage": 1,
			"allNum": 763,
			"maxResult": 20
		},
		"ret_code": 0
	}
}
服务级错误码参照
错误码 说明
-1 系统调用错误
-2 可调用次数或金额为0
-3 读取超时
-4 服务端返回数据解析错误
-5 后端服务器DNS解析错误
-6 服务不存在或未上线
-1000 系统维护
-1002 showapi_appid字段必传
-1003 showapi_sign字段必传
-1004 签名sign验证有误
-1005 showapi_timestamp无效
-1006 app无权限调用接口
-1007 没有订购套餐
-1008 服务商关闭对您的调用权限
-1009 调用频率受限
-1010 找不到您的应用
-1011 子授权app_child_id无效
-1012 子授权已过期或失效
-1013 子授权ip受限
完整教学代码示例
public static void main(String path[]) throws Exception {
URL u = new URL("http://route.showapi.com/1610-1?showapi_appid%3Dmyappid%26cityName%3D%26hourseName%3D%26page%3D%26showapi_sign%3Dmysecret");
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"));
}
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2019/3/15 17:50
 */
//----------------------------------
// 易源 全国房产信息 调用类
//----------------------------------
class freeApi{
    private $apiId = false; //易源appid
    private $apiSecret = false; //易源secret
    private $apiUrl = 'http://route.showapi.com/1610-1';
    public function __construct($apiid,$secretkey){
        $this->apiId = $apiid;
        $this->apiSecret = $secretkey;
    }
    /**
     * url拼接
     * @return string
     */
    private function handleParam($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后的值作为参数,便于服务器的效验
        return '?'.$paraStr;
    }
    /**
     * 将JSON内容转为数据,并返回
     * @param string $content [内容]
     * @return array
     */
    public function returnArray($content){
        return json_decode($content,true);
    }
    /**
     * 获取 全国房产信息 结果
     * @return array
     */
    public function getResult(){
        $paramArr = [
            'showapi_appid'=> $this->apiId,
            'cityName'=> "",
            'hourseName'=> "",
            'page'=> ""
        ];
        return $this->returnArray($this->freeApiCurl($this->apiUrl.$this->handleParam($paramArr,$this->apiSecret)));
    }
    /**
     * 请求接口返回内容
     * @param  string $url [请求的URL地址]
     * @param  string $params [请求的参数]
     * @param  int $ipost [是否采用POST形式]
     * @return  string
     */
    public function freeApiCurl($url,$params=false,$ispost=0){
        $ch = curl_init();
        curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
        curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
        curl_setopt( $ch, CURLOPT_USERAGENT , 'free-api' );
        curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 );
        curl_setopt( $ch, CURLOPT_TIMEOUT , 60);
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );
        if( $ispost )
        {
            curl_setopt( $ch , CURLOPT_POST , true );
            curl_setopt( $ch , CURLOPT_POSTFIELDS , $params );
            curl_setopt( $ch , CURLOPT_URL , $url );
        }
        else
        {
            if($params){
                curl_setopt( $ch , CURLOPT_URL , $url.'?'.$params );
            }else{
                curl_setopt( $ch , CURLOPT_URL , $url);
            }
        }
        $response = curl_exec( $ch );
        if ($response === FALSE) {
            return false;
        }
        curl_close( $ch );
        return $response;
    }
}
//推荐使用npm安装使用sdk: npm install --save showapi-sdk
'use strict';

var showapiSdk = require('showapi-sdk');

//设置你测试用的appId和secret,img
var appId='';
var secret='';
//开启debug
//showapiSdk.debug(true);
if(!(appId&&secret)){
  console.error('请先设置appId等测试参数,详见样例代码内注释!')
  return;
}
//全局默认设置
showapiSdk.setting({
  url:"http://route.showapi.com/1610-1",//你要调用的API对应接入点的地址,注意需要先订购了相关套餐才能调
  appId:appId,//你的应用id
  secret:secret,//你的密钥
  timeout:5000,//http超时设置
  options:{//默认请求参数,极少用到
    testParam:'test'
  }
})

var request=showapiSdk.request();
request.appendText('cityName','');
request.appendText('hourseName','');
request.appendText('page','');
request.post(function(data){
  console.info(data)
})
package main

import (
"showSdk/normalRequest"
"fmt"
)
res := normalRequest.ShowapiRequest("http://route.showapi.com/1610-1",my_appId,"my_appSecret")
res.AddTextPara("cityName","")
res.AddTextPara("hourseName","")
res.AddTextPara("page","")
//res.AddFilePara("img", "C:\\Users\\showa\\Desktop\\使用过的\\4.png")//文件上传时设置
fmt.Println(res.Post())
# python3.6.5
# 需要引入requests包 :运行终端->进入python/Scripts ->输入:pip install requests
from ShowapiRequest import ShowapiRequest

r = ShowapiRequest("http://route.showapi.com/1610-1","my_appId","my_appSecret" )
r.addBodyPara("cityName", "")
r.addBodyPara("hourseName", "")
r.addBodyPara("page", "")
# r.addFilePara("img", r"C:\Users\showa\Desktop\使用过的\4.png") #文件上传时设置
res = r.post()
print(res.text) # 返回信息