银行联行号查询
请求Header:
名称 | 值 | |
---|---|---|
Content-Type | application/x-www-form-urlencoded |
请求参数说明:
名称 | 必填 | 类型 | 说明 | |
---|---|---|---|---|
key | 是 | string | 在个人中心->我的数据,接口名称上方查看 | |
bankcard | 否 | string | 银行卡号 | |
bank | 否 | string | 银行名,如:中国银行 | |
province | 否 | string | 省份,如:山东 | |
city | 否 | string | 城市,如:济南 | |
keyword | 否 | string | 关键字 | |
page | 否 | string | 页码,默认:1 |
请求代码示例:
curl -k -i "http://apis.juhe.cn/interbank/query?key=key&bankcard=6321xxxxxxxx432&bank=&province=&city=%E8%8B%8F%E5%B7%9E&keyword=&page=20"
我的数据,接口名称上方查看
// 接口请求入参配置
$requestParams = [
'key' => $apiKey,
'bankcard'=> '6321xxxxxxxx432',
'bank'=> '',
'province'=> '',
'city'=> '苏州',
'keyword'=> '',
'page'=> '20',
];
$requestParamsStr = http_build_query($requestParams);
// 发起接口网络请求
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $apiUrl . '?' . $requestParamsStr);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
if (1 == strpos("$" . $apiUrl, "https://")) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
$response = curl_exec($curl);
$httpInfo = curl_getinfo($curl);
curl_close($curl);
// 解析响应结果
$responseResult = json_decode($response, true);
if ($responseResult) {
// 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
var_dump($responseResult);
} else {
// 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
// var_dump($httpInfo);
var_dump("请求异常");
}
import requests
# 1220-银行联行号查询 - 代码参考(根据实际业务情况修改)
# 基本参数配置
apiUrl = 'http://apis.juhe.cn/interbank/query' # 接口请求URL
apiKey = '您申请的调用APIkey' # 在个人中心->我的数据,接口名称上方查看
# 接口请求入参配置
requestParams = {
'key': apiKey,
'bankcard': '6321xxxxxxxx432',
'bank': '',
'province': '',
'city': '苏州',
'keyword': '',
'page': '20',
}
# 发起接口网络请求
response = requests.get(apiUrl, params=requestParams)
# 解析响应结果
if response.status_code == 200:
responseResult = response.json()
# 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
print(responseResult)
else:
# 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
print('请求异常')
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
func main() {
// 基本参数配置
apiUrl := "http://apis.juhe.cn/interbank/query"
apiKey := "您申请的调用APIkey"
// 接口请求入参配置
requestParams := url.Values{}
requestParams.Set("key", apiKey)
requestParams.Set("bankcard", "6321xxxxxxxx432")
requestParams.Set("bank", "")
requestParams.Set("province", "")
requestParams.Set("city", "苏州")
requestParams.Set("keyword", "")
requestParams.Set("page", "20")
// 发起接口网络请求
resp, err := http.Get(apiUrl + "?" + requestParams.Encode())
if err != nil {
fmt.Println("网络请求异常:", err)
return
}
defer resp.Body.Close()
var responseResult map[string]interface{}
err = json.NewDecoder(resp.Body).Decode(&responseResult)
if err != nil {
fmt.Println("解析响应结果异常:", err)
return
}
fmt.Println(responseResult)
}
using System;
using System.Net;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
namespace Common_API_Test.Test_Demo
{
class Csharp_get
{
static void Main(string[] args)
{
string url = "http://apis.juhe.cn/interbank/query";
string apiKey = "您申请的调用APIkey";
Dictionary data = new Dictionary();
data.Add("key", apiKey);
data.Add( "bankcard", "6321xxxxxxxx432");
data.Add( "bank", "");
data.Add( "province", "");
data.Add( "city", "苏州");
data.Add( "keyword", "");
data.Add( "page", "20");
using (WebClient client = new WebClient())
{
string fullUrl = url + "?" + string.Join("&", data.Select(x => x.Key + "=" + x.Value));
try
{
string responseContent = client.DownloadString(fullUrl);
dynamic responseData = JsonConvert.DeserializeObject(responseContent);
if (responseData != null)
{
Console.WriteLine("Return Code: " + responseData["error_code"]);
Console.WriteLine("Return Message: " + responseData["reason"]);
}
else
{
Console.WriteLine("json解析异常!");
}
}
catch (Exception)
{
Console.WriteLine("请检查其它错误");
}
}
}
}
}
const axios = require('axios'); // npm install axios
// 基本参数配置
const apiUrl = 'http://apis.juhe.cn/interbank/query'; // 接口请求URL
const apiKey = '您申请的调用APIkey'; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
const requestParams = {
key: apiKey,
bankcard: '6321xxxxxxxx432',
bank: '',
province: '',
city: '苏州',
keyword: '',
page: '20',
};
// 发起接口网络请求
axios.get(apiUrl, {params: requestParams})
.then(response => {
// 解析响应结果
if (response.status === 200) {
const responseResult = response.data;
// 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
console.log(responseResult);
} else {
// 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
console.log('请求异常');
}
})
.catch(error => {
// 网络请求失败,可以根据实际情况进行处理
console.log('网络请求失败:', error);
});
package cn.juhe.test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
public class JavaGet {
public static void main(String[] args) throws Exception {
String apiKey = "你申请的key";
String apiUrl = "http://apis.juhe.cn/interbank/query";
HashMap map = new HashMap<>();
map.put("key", apiKey);
map.put("bankcard", "6321xxxxxxxx432");
map.put("bank", "");
map.put("province", "");
map.put("city", "苏州");
map.put("keyword", "");
map.put("page", "20");
URL url = new URL(String.format("%s?%s", apiUrl, params(map)));
BufferedReader in = new BufferedReader(new InputStreamReader((url.openConnection()).getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response);
}
public static String params(Map map) {
return map.entrySet().stream()
.map(entry -> {
try {
return entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString());
} catch (Exception e) {
e.printStackTrace();
return entry.getKey() + "=" + entry.getValue();
}
})
.collect(Collectors.joining("&"));
}
}
// 基本参数配置
NSString *apiUrl = @"http://apis.juhe.cn/interbank/query"; // 接口请求URL
NSString *apiKey = @"您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
NSDictionary *requestParams = @{
@"key": apiKey,
@"bankcard": @"6321xxxxxxxx432",
@"bank": @"",
@"province": @"",
@"city": @"苏州",
@"keyword": @"",
@"page": @"20",
};
// 发起接口网络请求
NSURLComponents *components = [NSURLComponents componentsWithString:apiUrl];
NSMutableArray *queryItems = [NSMutableArray array];
[requestParams enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL *stop) {
[queryItems addObject:[NSURLQueryItem queryItemWithName:key value:value]];
}];
components.queryItems = queryItems;
NSURL *url = components.URL;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
// 网络请求异常处理
NSLog(@"请求异常");
} else {
NSError *jsonError;
NSDictionary *responseResult = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
if (!jsonError) {
// 网络请求成功处理
// NSLog(@"%@", [responseResult objectForKey:@"error_code"]);
NSLog(@"%@", responseResult);
} else {
// 解析结果异常处理
NSLog(@"解析结果异常");
}
}
}];
[task resume];
返回参数说明:
名称 | 类型 | 说明 | |
---|---|---|---|
error_code | int | 状态码,返回0,235603时计费 | |
reason | string | 状态提示 | |
result | json | 返回结果--具体见示例描述 |
JSON返回示例:JSON在线格式化工具 >
{
"reason":"成功",
"result":{
"data":{
"page":"1",/**当前页数*/
"bank":"湖南省农村信用社联合社",/**银行名称(传入的参数)*/
"totalpage":"254",/**总页数*/
"card":"6230901804081211668",/**银行卡号(传入的参数)*/
"totalcount":"2534",/**总记录数*/
"record":[/** */
{
"addr":"湖南省长沙市浏阳市关口街道道吾东路182号浏阳农商行关口支行",/**银行地址*/
"bank":"湖南省农村信用社联合社",/**银行名称*/
"city":"长沙市",/**银行所在城市*/
"province":"湖南省",/**银行所在省*/
"bankCode":"314551000017",/**联行号*/
"tel":"83611373",/**支行电话*/
"lname":"湖南浏阳农村商业银行股份有限公司"/**支行名称*/
},
{
"addr":"湖南省长沙市浏阳市北正南路100号",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000025",
"tel":"0731-83625163",
"lname":"湖南浏阳农村商业银行股份有限公司淮川支行"
},
{
"addr":"湖南省浏阳市圭斋西路148号",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000033",
"tel":"0731-83619814",
"lname":"湖南浏阳农村商业银行股份有限公司圭斋西路分理处"
},
{
"addr":"湖南省浏阳市劳动中路2号",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000041",
"tel":"0731-83616041",
"lname":"湖南浏阳农村商业银行股份有限公司圭斋东路分理处"
},
{
"addr":"湖南省浏阳市金沙中路24号",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000050",
"tel":"0731-83613948",
"lname":"湖南浏阳农村商业银行股份有限公司金沙路分理处"
},
{
"addr":"湖南省浏阳市淮川办事处城东社区",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000068",
"tel":"0731-83613079",
"lname":"湖南浏阳农村商业银行股份有限公司城东分理处"
},
{
"addr":"湖南省浏阳市关口办事处道吾山东路四季花城1栋",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000076",
"tel":"0731-83616094",
"lname":"湖南浏阳农村商业银行股份有限公司关口支行"
},
{
"addr":"湖南省浏阳市关口办事处占佳村",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000084",
"tel":"0731-83629766",
"lname":"湖南浏阳农村商业银行股份有限公司占佳分理处"
},
{
"addr":"湖南省浏阳市关口办事处关口村",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000092",
"tel":"0731-83663979",
"lname":"湖南浏阳农村商业银行股份有限公司长坪分理处"
},
{
"addr":"浏阳市淮川街道办事处白沙路市民之家一楼",
"bank":"湖南省农村信用社联合社",
"city":"长沙市",
"province":"湖南省",
"bankCode":"314551000105",
"tel":"0731-89636708",
"lname":"湖南浏阳农村商业银行股份有限公司白沙路分理处"
}
]
},
"orderid":"JH356202212121601526803"
},
"error_code":0
}
服务级错误码参照(error_code):
错误码 | 说明 | |
---|---|---|
235601 | 服务商网络异常,请重试 | |
235602 | 参数错误,具体请看 reason | |
235603 | 查无记录(计费) | |
235604 | 查询失败,具体请看 reason |
系统级错误码参照:
错误码 | 说明 | 旧版本(resultcode) | |
---|---|---|---|
10001 | 错误的请求KEY | 101 | |
10002 | 该KEY无请求权限 | 102 | |
10003 | KEY过期 | 103 | |
10004 | 错误的OPENID | 104 | |
10005 | 应用未审核超时,请提交认证 | 105 | |
10007 | 未知的请求源 | 107 | |
10008 | 被禁止的IP | 108 | |
10009 | 被禁止的KEY | 109 | |
10011 | 当前IP请求超过限制 | 111 | |
10012 | 请求超过次数限制 | 112 | |
10013 | 测试KEY超过请求限制 | 113 | |
10014 | 系统内部异常(调用充值类业务时,请务必联系客服或通过订单查询接口检测订单,避免造成损失) | 114 | |
10020 | 接口维护 | 120 | |
10021 | 接口停用 | 121 |
错误码格式说明(示例:200201):
2 | 002 | 01 | |
---|---|---|---|
服务级错误(1为系统级错误) | 服务模块代码(即数据ID) | 具体错误代码 |