区块链API
版本:
v0.1
日期:
2017年05月27日
目录
[TOC]
消息字段
标
//omsId,"LOAN_"+"OMSID_"+时间戳
String id
//借款标题
String titlec
//OMSID
String omsId
//oms name
String omsName
//OMS钱包地址
String omsWalletAddress
//借款人姓名
String borrowerName
//借款人电话
String borrowerPhone
//借款人地址
String borrowerAddress
//借款人身份证号
String borrowerIdCardNumber
//借款人钱包地址
String borrowerWalletAddress
//借款人说明
String borrowerDescription
//10 发售中;20 已满额(待扣投资款);30 已流标;40 待还款;50 待扣还款?;60 已结清;70 已逾期?
int status
//计息方式,暂只支持按年
int rateTimeUnit
//利率(年)
Double rate
//借款额
Double amount
//oms收费,借款人收到资金=amount-omsFee
Double omsFee
//利息总额
Double interestAmount
//还款总额=借款额+利息总额
Double refundAmount
//审批状态,未使用
int approveStatus
//审批时间,未使用
Timestamp approveTime
//期限时间单位,暂时未启用
int periodTimeUnit
//期限,天
int period
//还款方式,暂时只支持到期全款支付
int refundType
//筹标截止时间
Timestamp deadTime
//起息时间,标满开始计息
Timestamp startTime
//计划还款时间,startTime+period
Timestamp refundTime
//实际还款时间
Timestamp realRefoundTime
//已认购金额
Double enterAmount
//已认购笔数
int enterCount
//已还款
Boolean isRefunded
//序列号,未使用
String serialNumber
//合同号,未使用
String contractCode
//合同描述,未使用
String contractDesc
//起投金额
Double startInvestAmount
//递增金额
Double increaseInvestAmount
//区块链txid
String chainTxId
//区块号
String blockId
//描述
String description
//资金用途
String fundUsage
//还款来源
String repaySource
//征信
String creditInformation
//担保信息
String guaranteeInformation
用户
//用户id
String id
//手机号,登录用户
String mobilePhone
//密码
String password
//姓名
String realName
//注册时间
Timestamp registerTime
//身份证号
String idCardNumber
//实名认证状态。0 创建;10 已实名验证;20 已导入钱包
int authStatus
//实名认证时间
Timestamp authTime
//钱包地址
String walletAddress
//钱包pubKey
String walletPubKey
//总资产
Double totalAmount
//可用资产
Double usableAmount
//冻结金额
Double frozenAmount
//投资总收益
Double interestAmount
//投资总笔数
int loanCount
//投资总金额
Double loanAmount
//已回收笔数
int recoveredCount
//已回收总金额
Double recoveredAmount
//已回收的本金
Double recoveredPrincipal
//已回收收益
Double recoveredInterest
//待回收笔数
int unRecoveredCount
//待回收总额
Double unrecoveredAmount
//待回收的本金
Double unRecoveredPrincipal
//待回收的收益
Double unRecoveredInterest
投资
//"INVEST_"+"marketId_"+"13位时间戳"
String id
//标ID
String loanId
//oms id
String omsId
//market Id
String marketId
//投资人id
String investorId
//投资人身份证号
String investorIdCardNumber
//投资人钱包地址
String inverstorWalletAddress
//投资金额
Double amount
//预期收益
Double interestAmount
//回款总金额
Double refundAmount
//10,投资提交20,资金已冻结30,取消投资40,待扣投资款50,待回款60,已还款70,已逾期?
int status
//创建时间
Timestamp createTime
//开始计息时间
Timestamp startTime
//到期时间
Timestamp refoundTime
//实际回款时间
Timestamp realRefoundTime
//区块链txid
String chainTxId
//区块号
String blockId
API
1 OMS
1.1 借款上链
URL
https://apis.qianbao.com/jiedai/v1/oms/loan
Method
POST
Header
Content-type: application/x-www-form-urlencoded;charset=utf-8
RequestBody
"title": "天津买房首付",
"borrowerName": "zz",
"borrowerIdCardNumber": "10100000000000000",
"borrowerWalletAddress": "walet101",
"borrowerPhone": "13888888888",
"borrowerAddress": "北京市朝阳区",
"borrowerDescription": "一个好人",
"amount": 500000,
"omsFee": 5000,
"rate": 0.1,
"period": 90,
"interestAmount": 12328.77,
"deadTime": "2017-07-31 23:59:59",
"startInvestAmount": 10000,
"increaseInvestAmount": 1000,
"description": "good",
"fundUsage": "买房",
"repaySource": "工资",
"creditInformation": "very good",
"guaranteeInformation": "赵老板"
ReponseBody
{
"status": "20000551",
"message": "OK"
}
1.2 查询借款列表
URL
https://apis.qianbao.com/jiedai/v1/oms/loans?status={status}
status参数可选
Method
GET
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": [
{
"id": "LOAN_oms001_1500606584559",
"title": "天津买房首付",
"omsId": "oms001",
"omsName": "乾元OMS",
"omsWalletAddress": "wallet_Oms001",
"borrowerName": "zz",
"borrowerPhone": "13888888888",
"borrowerAddress": "北京市朝阳区",
"borrowerIdCardNumber": "10100000000000000",
"borrowerWalletAddress": "walet101",
"borrowerDescription": "一个好人",
"status": 10,
"rateTimeUnit": 2,
"rate": 0.1,
"amount": 500000,
"omsFee": 5000,
"interestAmount": 12328.77,
"refundAmount": 512328.77,
"approveStatus": 3,
"approveTime": 1500606585000,
"periodTimeUnit": 1,
"period": 90,
"refundType": 0,
"deadTime": 1501516799000,
"enterAmount": 0,
"enterCount": 0,
"isRefunded": false,
"startInvestAmount": 10000,
"increaseInvestAmount": 1000,
"description": "good",
"fundUsage": "买房",
"repaySource": "工资",
"creditInformation": "very good",
"guaranteeInformation": "赵老板"
},
{
"id": "LOAN_oms001_1500606668343",
"title": "登录火星",
"omsId": "oms001",
"omsName": "乾元OMS",
"omsWalletAddress": "wallet_Oms001",
"borrowerName": "gx",
"borrowerPhone": "13888888888",
"borrowerAddress": "北京市朝阳区",
"borrowerIdCardNumber": "10100000000000000",
"borrowerWalletAddress": "walet101",
"borrowerDescription": "一个好人",
"status": 10,
"rateTimeUnit": 2,
"rate": 0.1,
"amount": 500000,
"omsFee": 5000,
"interestAmount": 12328.77,
"refundAmount": 512328.77,
"approveStatus": 3,
"approveTime": 1500606669000,
"periodTimeUnit": 1,
"period": 90,
"refundType": 0,
"deadTime": 1501516799000,
"enterAmount": 0,
"enterCount": 0,
"isRefunded": false,
"startInvestAmount": 10000,
"increaseInvestAmount": 1000,
"description": "good",
"fundUsage": "火星",
"repaySource": "火星采矿",
"creditInformation": "very good",
"guaranteeInformation": "赵老板"
}
]
}
1.3 查询借款
URL
https://apis.qianbao.com/jiedai/v1/oms/loan/{id}
Method
GET
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": {
"id": "LOAN_oms001_1500606584559",
"title": "天津买房首付",
"omsId": "oms001",
"omsName": "乾元OMS",
"omsWalletAddress": "wallet_Oms001",
"borrowerName": "zz",
"borrowerPhone": "13888888888",
"borrowerAddress": "北京市朝阳区",
"borrowerIdCardNumber": "10100000000000000",
"borrowerWalletAddress": "walet101",
"borrowerDescription": "一个好人",
"status": 10,
"rateTimeUnit": 2,
"rate": 0.1,
"amount": 500000,
"omsFee": 5000,
"interestAmount": 12328.77,
"refundAmount": 512328.77,
"approveStatus": 3,
"approveTime": 1500606585000,
"periodTimeUnit": 1,
"period": 90,
"refundType": 0,
"deadTime": 1501516799000,
"enterAmount": 0,
"enterCount": 0,
"isRefunded": false,
"startInvestAmount": 10000,
"increaseInvestAmount": 1000,
"description": "good",
"fundUsage": "买房",
"repaySource": "工资",
"creditInformation": "very good",
"guaranteeInformation": "赵老板"
}
}
参数错误
{
"message": "借款不存在",
"status": "40400551"
}
2 p2p
2.1 查询借款列表
URL
https://apis.qianbao.com/jiedai/v1/p2p/loans?status={status}
status参数可选
Method
GET
ReponseBody:
参考1.2
2.2 查询借款
URL
curl https://apis.qianbao.com/jiedai/v1/p2p/loans/{id}
Method
GET
ReponseBody:
参考1.3
2.3 注册验证码
URL
https://apis.qianbao.com/jiedai/v1/p2p/register/sms?mobilePhone={mobilePhone}
Method
GET
ReponseBody:
{
"status": "20000551",
"message": "OK"
}
2.4 注册
URL
https://apis.qianbao.com/jiedai/v1/p2p/register?smsCode=?
Method
POST
Header
Content-type: application/x-www-form-urlencoded;charset=utf-8
RequestBody
"mobilePhone":"18610274382"
"password":"123"
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": {
"token": "667d6b13a2314d5797722adca31aaa34",
"investorId": "market001_investor_1500610469952"
}
}
2.5 登录
URL
https://apis.qianbao.com/jiedai/v1/p2p/login
Method
POST
Header
Content-type: application/x-www-form-urlencoded;charset=utf-8
RequestBody
"mobilePhone":"18610274382"
"password":"123"
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": {
"token": "7f9b75c28a264eac8582f3b58c02e3d1",
"investorId": "market001_investor_1500610469952"
}
}
2.6 退出登录
URL
https://apis.qianbao.com/jiedai/v1/p2p/logout?QB_AUTH_TOKEN={token}
Method
DELETE
ReponseBody:
{
"status": "20000551",
"message": "OK"
}
2.7 实名认证
URL
https://apis.qianbao.com/jiedai/v1/p2p/investor/auth?QB_AUTH_TOKEN={token}
Method
PUT
Header
"Content-type: application/json;charset=utf-8"
RequestBody
"realName":"高翔"
"idCardNumber":"42012345678901234"
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": {
"id": "market001_investor_1500610469952",
"mobilePhone": "18610274382",
"realName": "高翔",
"registerTime": 1500610470000,
"idCardNumber": "42012345678901234",
"authStatus": 10,
"authTime": 1500610750014,
"totalAmount": 0,
"usableAmount": 0,
"frozenAmount": 0,
"interestAmount": 0,
"loanCount": 0,
"loanAmount": 0,
"recoveredCount": 0,
"recoveredAmount": 0,
"recoveredPrincipal": 0,
"recoveredInterest": 0,
"unRecoveredCount": 0,
"unrecoveredAmount": 0,
"unRecoveredPrincipal": 0,
"unRecoveredInterest": 0
}
}
2.8 导入钱包
URL
https://apis.qianbao.com/jiedai/v1/p2p/investor/wallet?QB_AUTH_TOKEN={token}
Method
PUT
Header
"Content-type: application/json;charset=utf-8"
RequestBody
"walletAddress":"Wallet18610274382"
"walletPubKey":"WalletPubKey001"
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": {
"id": "market001_investor_1500610469952",
"mobilePhone": "18610274382",
"realName": "高翔",
"registerTime": 1500610470000,
"idCardNumber": "42012345678901234",
"authStatus": 20,
"authTime": 1500610750000,
"walletAddress": "Wallet18610274382",
"totalAmount": 0,
"usableAmount": 0,
"frozenAmount": 0,
"interestAmount": 0,
"loanCount": 0,
"loanAmount": 0,
"recoveredCount": 0,
"recoveredAmount": 0,
"recoveredPrincipal": 0,
"recoveredInterest": 0,
"unRecoveredCount": 0,
"unrecoveredAmount": 0,
"unRecoveredPrincipal": 0,
"unRecoveredInterest": 0
}
}
2.9 当前用户详细信息
URL
https://apis.qianbao.com/jiedai/v1/p2p/investor?QB_AUTH_TOKEN={token}
Method
GET
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": {
"id": "market001_investor_1500610469952",
"mobilePhone": "18610274382",
"realName": "高翔",
"registerTime": 1500610470000,
"idCardNumber": "42012345678901234",
"authStatus": 20,
"authTime": 1500610750000,
"walletAddress": "Wallet18610274382",
"totalAmount": 0,
"usableAmount": 0,
"frozenAmount": 0,
"interestAmount": 0,
"loanCount": 0,
"loanAmount": 0,
"recoveredCount": 0,
"recoveredAmount": 0,
"recoveredPrincipal": 0,
"recoveredInterest": 0,
"unRecoveredCount": 0,
"unrecoveredAmount": 0,
"unRecoveredPrincipal": 0,
"unRecoveredInterest": 0
}
}
2.10 投资
URL
https://apis.qianbao.com/jiedai/v1/p2p/invest?QB_AUTH_TOKEN={token}
Method
POST
Header
"Content-type: application/json;charset=utf-8"
RequestBody
"loanId":"LOAN_oms001_1500186027844"
"amount":400000
ReponseBody:
{
"status": "20000551",
"message": "OK"
}
异常
{
"message": "可投金额不足",
"status": "40000551"
}
2.11 用户投资列表
URL
curl https://apis.qianbao.com/jiedai/v1/p2p/invests?status={status}&QB_AUTH_TOKEN={token}
status参数可选
Method
GET
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": [
{
"id": "INVEST_market001_1500611289445",
"loanId": "LOAN_oms001_1500611158732",
"omsId": "oms001",
"marketId": "market001",
"investorId": "market001_investor_1500610469952",
"investorIdCardNumber": "42012345678901234",
"inverstorWalletAddress": "Wallet18610274382",
"amount": 100000,
"interestAmount": 2465.76,
"refundAmount": 102465.76,
"status": 10,
"createTime": 1500611289000,
"startTime": 1500611339000,
"refoundTime": 1508387339000
},
{
"id": "INVEST_market001_1500611339482",
"loanId": "LOAN_oms001_1500611158732",
"omsId": "oms001",
"marketId": "market001",
"investorId": "market001_investor_1500610469952",
"investorIdCardNumber": "42012345678901234",
"inverstorWalletAddress": "Wallet18610274382",
"amount": 400000,
"interestAmount": 9863.01,
"refundAmount": 409863.01,
"status": 10,
"createTime": 1500611339000,
"startTime": 1500611339000,
"refoundTime": 1508387339000
}
]
}
2.12 查询指定投资
URL
curl https://apis.qianbao.com/jiedai/v1/p2p/invest/{id}?QB_AUTH_TOKEN={token}
Method
GET
ReponseBody:
{
"status": "20000551",
"message": "OK",
"result": {
"id": "INVEST_market001_1500611289445",
"loanId": "LOAN_oms001_1500611158732",
"omsId": "oms001",
"marketId": "market001",
"investorId": "market001_investor_1500610469952",
"investorIdCardNumber": "42012345678901234",
"inverstorWalletAddress": "Wallet18610274382",
"amount": 100000,
"interestAmount": 2465.76,
"refundAmount": 102465.76,
"status": 10,
"createTime": 1500611289000,
"startTime": 1500611339000,
"refoundTime": 1508387339000
}
}