Skip to content

IncomeLocker/InlockApiGW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IncomeApiGW - INLOCK.io frontend Application Programable Interface

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 User's Account

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]"
}

Success Response

Condition : If everything is OK and an Account didn't exist for this User.

Code : 201 CREATED

Content example

{
    "result": "ok"
}

Error Responses

Condition : If Account already exists for User.

Code : 400 BAD REQUEST

Content :

{
    "result": "user already exists"
}

Or

Condition : If fields are missed.

Code : 400 BAD REQUEST

Content example

{
    "name": [
        "This field is required."
    ]
}

List Collaterals

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

Success Response

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
        }, 
    ]
}

Error Responses

Condition : There is no any collateral for requested user

Code : 400 BAD REQUEST

Content :

{
    "lockCollateral": "*message*"
}

Or

Condition : If fields are missed.

Code : 400 BAD REQUEST

Content example

{
    "name": [
        "This field is required."
    ]
}

Lock Collateral

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]",
}

Success Response

Condition : If everything is OK and an Account didn't exist for this User.

Code : 200 OK

Content example

{
    "result": "ok"
}

Error Responses

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*"
}

Or

Condition : If fields are missed.

Code : 400 BAD REQUEST

Content example

{
    "name": [
        "This field is required."
    ]
}

Cancel Collateral

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]"
}

Success Response

Condition : Existing collateral succesfully canceled. Pending balance also refunded and available for User

Code : 200 OK

Content example

{
    "result": "ok"
}

Error Responses

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*"
}

Or

Condition : If fields are missed.

Code : 400 BAD REQUEST

Content example

{
    "name": [
        "This field is required."
    ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published