區(qū)塊鏈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 發(fā)售中;20 已滿額(待扣投資款);30 已流標;40 待還款;50 待扣還款薪棒?;60 已結清;70 已逾期累奈?
int status
//計息方式,暫只支持按年
int rateTimeUnit
//利率(年)
Double rate
//借款額
Double amount
//oms收費,借款人收到資金=amount-omsFee
Double omsFee
//利息總額
Double interestAmount
//還款總額=借款額+利息總額
Double refundAmount
//審批狀態(tài),未使用
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
//區(qū)塊鏈txid
String chainTxId
//區(qū)塊號
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
//實名認證狀態(tài)。0 創(chuàng)建;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
//創(chuàng)建時間
Timestamp createTime
//開始計息時間
Timestamp startTime
//到期時間
Timestamp refoundTime
//實際回款時間
Timestamp realRefoundTime
//區(qū)塊鏈txid
String chainTxId
//區(qū)塊號
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": "北京市朝陽區(qū)",
"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": "北京市朝陽區(qū)",
"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": "北京市朝陽區(qū)",
"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": "北京市朝陽區(qū)",
"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
}
}