公积金贷款计算器
请求Header:
| 名称 | 值 | |
|---|---|---|
| Content-Type | application/x-www-form-urlencoded |
请求参数说明:
| 名称 | 必填 | 类型 | 说明 | |
|---|---|---|---|---|
| key | 是 | string | 在个人中心->我的数据,接口名称上方查看 | |
| money | 是 | number | 贷款金额(0 < money <= 500),单位(万),如70表示70万; | |
| year | 是 | string | 贷款年限,单位(年),仅限输入 5、10、15、20、25、30 | |
| active | 否 | string | 贷款利率,默认3.25 |
请求代码示例:
curl -k -i "https://apis.juhe.cn/fapig/loanCalc/loan?key=key&money=xxx&year=2024&active="
<?php
/**
* 1570-公积金贷款计算器 - 代码参考(根据实际业务情况修改)
*/
// 基本参数配置
$apiUrl = "https://apis.juhe.cn/fapig/loanCalc/loan"; // 接口请求URL
$method = "GET"; // 接口请求方式
$headers = ["Content-Type: application/x-www-form-urlencoded"]; // 接口请求header
$apiKey = "您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
$requestParams = [
'key' => $apiKey,
'money'=> 'xxx',
'year'=> '2024',
'active'=> '',
];
$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
# 1570-公积金贷款计算器 - 代码参考(根据实际业务情况修改)
# 基本参数配置
apiUrl = 'https://apis.juhe.cn/fapig/loanCalc/loan' # 接口请求URL
apiKey = '您申请的调用APIkey' # 在个人中心->我的数据,接口名称上方查看
# 接口请求入参配置
requestParams = {
'key': apiKey,
'money': 'xxx',
'year': '2024',
'active': '',
}
# 发起接口网络请求
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 := "https://apis.juhe.cn/fapig/loanCalc/loan"
apiKey := "您申请的调用APIkey"
// 接口请求入参配置
requestParams := url.Values{}
requestParams.Set("key", apiKey)
requestParams.Set("money", "xxx")
requestParams.Set("year", "2024")
requestParams.Set("active", "")
// 发起接口网络请求
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 = "https://apis.juhe.cn/fapig/loanCalc/loan";
string apiKey = "您申请的调用APIkey";
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("key", apiKey);
data.Add( "money", "xxx");
data.Add( "year", "2024");
data.Add( "active", "");
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 = 'https://apis.juhe.cn/fapig/loanCalc/loan'; // 接口请求URL
const apiKey = '您申请的调用APIkey'; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
const requestParams = {
key: apiKey,
money: 'xxx',
year: '2024',
active: '',
};
// 发起接口网络请求
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 = "https://apis.juhe.cn/fapig/loanCalc/loan";
HashMap<String, String> map = new HashMap<>();
map.put("key", apiKey);
map.put("money", "xxx");
map.put("year", "2024");
map.put("active", "");
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<String, String> 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 = @"https://apis.juhe.cn/fapig/loanCalc/loan"; // 接口请求URL
NSString *apiKey = @"您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
NSDictionary *requestParams = @{
@"key": apiKey,
@"money": @"xxx",
@"year": @"2024",
@"active": @"",
};
// 发起接口网络请求
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 | 返回码 | |
| reason | string | 返回码描述 | |
| bx | object | 贷款本息还款对象 | |
| bx.bxPerMonth | string | 每月还款 | |
| bx.bxTotal | string | 本息合计 | |
| bx.lxPerMonth | string | 每月利息 | |
| bx.lxTotal | string | 总支付利息 | |
| bj | object | 贷款本金还款对象 | |
| bj.bxTotal | object | 本息合计 | |
| bj.lxTotal | object | 总支付利息 | |
| bj.perMonth | object | 每月还款明细 | |
| bj.lxLastMonth | object | 最后一个月利息 | |
| bj.lxFirstMonth | object | 第一个月利息 | |
| bj.capital | object | 每月本金 |
JSON返回示例:JSON在线格式化工具 >
{
"reason": "success",
"result": {
"bx": {
"bxPerMonth": "3301.68",
"bxTotal": "1188603.87",
"lxPerMonth": "1357.233",
"lxTotal": "488603.87"
},
"bj": {
"bxTotal": "1110637.50",
"lxTotal": "410637.50",
"perMonth": ["4219.44", "4213.12", "4206.81", "4200.49", "4194.17", "4187.85", "4181.53", "4175.21", "4168.89", "4162.57", "4156.25", "4149.93", "4143.61", "4137.29", "4130.97", "4124.65", "4118.33", "4112.01", "4105.69", "4099.38", "4093.06", "4086.74", "4080.42", "4074.10", "4067.78", "4061.46", "4055.14", "4048.82", "4042.50", "4036.18", "4029.86", "4023.54", "4017.22", "4010.90", "4004.58", "3998.26", "3991.94", "3985.62", "3979.31", "3972.99", "3966.67", "3960.35", "3954.03", "3947.71", "3941.39", "3935.07", "3928.75", "3922.43", "3916.11", "3909.79", "3903.47", "3897.15", "3890.83", "3884.51", "3878.19", "3871.88", "3865.56", "3859.24", "3852.92", "3846.60", "3840.28", "3833.96", "3827.64", "3821.32", "3815.00", "3808.68", "3802.36", "3796.04", "3789.72", "3783.40", "3777.08", "3770.76", "3764.44", "3758.12", "3751.81", "3745.49", "3739.17", "3732.85", "3726.53", "3720.21", "3713.89", "3707.57", "3701.25", "3694.93", "3688.61", "3682.29", "3675.97", "3669.65", "3663.33", "3657.01", "3650.69", "3644.38", "3638.06", "3631.74", "3625.42", "3619.10", "3612.78", "3606.46", "3600.14", "3593.82", "3587.50", "3581.18", "3574.86", "3568.54", "3562.22", "3555.90", "3549.58", "3543.26", "3536.94", "3530.62", "3524.31", "3517.99", "3511.67", "3505.35", "3499.03", "3492.71", "3486.39", "3480.07", "3473.75", "3467.43", "3461.11", "3454.79", "3448.47", "3442.15", "3435.83", "3429.51", "3423.19", "3416.88", "3410.56", "3404.24", "3397.92", "3391.60", "3385.28", "3378.96", "3372.64", "3366.32", "3360.00", "3353.68", "3347.36", "3341.04", "3334.72", "3328.40", "3322.08", "3315.76", "3309.44", "3303.12", "3296.81", "3290.49", "3284.17", "3277.85", "3271.53", "3265.21", "3258.89", "3252.57", "3246.25", "3239.93", "3233.61", "3227.29", "3220.97", "3214.65", "3208.33", "3202.01", "3195.69", "3189.38", "3183.06", "3176.74", "3170.42", "3164.10", "3157.78", "3151.46", "3145.14", "3138.82", "3132.50", "3126.18", "3119.86", "3113.54", "3107.22", "3100.90", "3094.58", "3088.26", "3081.94", "3075.62", "3069.31", "3062.99", "3056.67", "3050.35", "3044.03", "3037.71", "3031.39", "3025.07", "3018.75", "3012.43", "3006.11", "2999.79", "2993.47", "2987.15", "2980.83", "2974.51", "2968.19", "2961.88", "2955.56", "2949.24", "2942.92", "2936.60", "2930.28", "2923.96", "2917.64", "2911.32", "2905.00", "2898.68", "2892.36", "2886.04", "2879.72", "2873.40", "2867.08", "2860.76", "2854.44", "2848.12", "2841.81", "2835.49", "2829.17", "2822.85", "2816.53", "2810.21", "2803.89", "2797.57", "2791.25", "2784.93", "2778.61", "2772.29", "2765.97", "2759.65", "2753.33", "2747.01", "2740.69", "2734.38", "2728.06", "2721.74", "2715.42", "2709.10", "2702.78", "2696.46", "2690.14", "2683.82", "2677.50", "2671.18", "2664.86", "2658.54", "2652.22", "2645.90", "2639.58", "2633.26", "2626.94", "2620.62", "2614.31", "2607.99", "2601.67", "2595.35", "2589.03", "2582.71", "2576.39", "2570.07", "2563.75", "2557.43", "2551.11", "2544.79", "2538.47", "2532.15", "2525.83", "2519.51", "2513.19", "2506.88", "2500.56", "2494.24", "2487.92", "2481.60", "2475.28", "2468.96", "2462.64", "2456.32", "2450.00", "2443.68", "2437.36", "2431.04", "2424.72", "2418.40", "2412.08", "2405.76", "2399.44", "2393.12", "2386.81", "2380.49", "2374.17", "2367.85", "2361.53", "2355.21", "2348.89", "2342.57", "2336.25", "2329.93", "2323.61", "2317.29", "2310.97", "2304.65", "2298.33", "2292.01", "2285.69", "2279.38", "2273.06", "2266.74", "2260.42", "2254.10", "2247.78", "2241.46", "2235.14", "2228.82", "2222.50", "2216.18", "2209.86", "2203.54", "2197.22", "2190.90", "2184.58", "2178.26", "2171.94", "2165.62", "2159.31", "2152.99", "2146.67", "2140.35", "2134.03", "2127.71", "2121.39", "2115.07", "2108.75", "2102.43", "2096.11", "2089.79", "2083.47", "2077.15", "2070.83", "2064.51", "2058.19", "2051.87", "2045.56", "2039.24", "2032.92", "2026.60", "2020.28", "2013.96", "2007.64", "2001.32", "1995.00", "1988.68", "1982.36", "1976.04", "1969.72", "1963.40", "1957.08", "1950.76"],
"lxLastMonth": "6.32",
"lxFirstMonth": "2275.00",
"capital": "1944.44"
}
},
"error_code": 0
}
服务级错误码参照(error_code):
| 错误码 | 说明 |
|---|
系统级错误码参照:
| 错误码 | 说明 | 旧版本(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) | 具体错误代码 |
接口文档下载
苏公网安备 32059002001776号