version: 0.2
RESTful API for Income Locker (inlock.io) frontend. Based on wsgi microframework. Default JSON output is 'pretty' printed, but you can switch to XML compressed output with "X-Requested-With: XMLHttpRequest" request header. Please use the compressed mode in production cases!
API categories:
Access to APIGW (login, etc.)
Tokenmarket functions
Request handling
Offer handling (borrower side)
Offer accepting (borrower side)
Contracting
Managing contracts
Contract close with payback
Contract close with termination
Create an Account for the authenticated User if an Account for that User does not already exist. Each User can only have one Account.
URL : https://api.inlock.io/inlock/api/v0.1/register
Method : POST
Auth required : NO
Permissions required : None
Data constraints
Provide necessary information of Account to be created.
{
"username": "[unicode 64 chars max]",
"email": "[standard email format]",
"greetname": "[short greating name, 28 chars max]",
"password": "[hashed password]",
"kyctoken": "[preauthentication KYC token]"
}
Condition : If everything is OK and an Account didn't exist for this User.
Code : 201 CREATED
Content example
{
"result": "ok"
}
Condition : If Account already exists for User.
Code : 400 BAD REQUEST
Content :
{
"result": "user already exists"
}
Condition : If fields are missed.
Code : 400 BAD REQUEST
Content example
{
"name": [
"This field is required."
]
}
List all existing locked collateras for authenticated user
URL : https://api.inlock.io/inlock/api/v0.1/listCollaterals
Method : GET
Auth required : YES
Permissions required : None
Data constraints
List all locked colleterals of authenticated user
Condition : If everything is OK and an Account didn't exist for this User.
Code : 200 OK
Content example
{
"collaterals": [
{
"collat_id": 10,
"status": "prepared",
"collat_mgmt_id": 0,
"created": "Fri, 30 Mar 2018 13:46:52 GMT",
"lastmodified": "Fri, 30 Mar 2018 13:46:52 GMT",
"margincall": 90.0, ### margin call percentage(%)
"cvalue_usd": 32059.8, ### collateral's value in USD
"c1_cointype": 2, ### coin ID
"c1_amount": 81.0 ### amount
},
]
}
Condition : There is no any collateral for requested user
Code : 400 BAD REQUEST
Content :
{
"lockCollateral": "*message*"
}
Condition : If fields are missed.
Code : 400 BAD REQUEST
Content example
{
"name": [
"This field is required."
]
}
Reserve collateral from user's balance and set the required parameters for further collateral management.
URL : https://api.inlock.io/inlock/api/v0.1/lockCollateral
Method : POST
Auth required : YES
Permissions required : None
Data constraints
Provide necessary information of Account to be created.
{
"coinid": "[int, based on /balance request's result]",
"amount": "[float, amount of locked collateral]",
"margincall": "[int, percentage of margin call after successful contracting]",
}
Condition : If everything is OK and an Account didn't exist for this User.
Code : 200 OK
Content example
{
"result": "ok"
}
Condition : Invalid coin referer or cannot mapped to requested user!
Condition : Not enought available balance to lock collateral
Condition : Internal error (invalid price information), please contact InLock support!
Code : 400 BAD REQUEST
Content :
{
"lockCollateral": "*message*"
}
Condition : If fields are missed.
Code : 400 BAD REQUEST
Content example
{
"name": [
"This field is required."
]
}
Cancel an existing and 'prepared' stated collateral.
URL : https://api.inlock.io/inlock/api/v0.1/cancelCollateral
Method : POST
Auth required : YES
Permissions required : None
Data constraints
Provide necessary information of Account to be created.
{
"cid": "[int, collateral id]"
}
Condition : Existing collateral succesfully canceled. Pending balance also refunded and available for User
Code : 200 OK
Content example
{
"result": "ok"
}
Condition : There is no any collateral for requested user
Condition : Cannot found balance of the collateral owner
Condition : Cannot cancel running or terminated collateral!
Condition : Collateral is not found, or maybe invalid
Code : 400 BAD REQUEST
Content :
{
"cancelCollateral": "*message*"
}
Condition : If fields are missed.
Code : 400 BAD REQUEST
Content example
{
"name": [
"This field is required."
]
}