Documentation
These are the available GET endpoints and their parameters.
Domain
Describe a domain
Endpoint:
- https://doubleloon.com/api/domain
URL Parameters:
- domain_id (string, required) - ID for the domain of the request
- key (string, required) - Domain security key (green or blue)
Example Reply:
{
"domain_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c6",
"name": "Default Domain"
}
- name (string) - The text describing the domain
Asset
Describe an asset
Endpoint:
- https://doubleloon.com/api/asset
URL Parameters:
- domain_id (string, required) - ID for the domain of the request
- asset_id (string, required) - ID for the asset of the request
- key (string, required) - Domain security key (green or blue)
Example Reply:
{
"asset_id": "f3ff64a2-8675-4e26-9338-d0ad8f947289",
"domain_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c6",
"name": "Default Asset"
}
- name (string) - The text describing the asset
Balance
Get a customer's balance
Endpoint:
- https://doubleloon.com/api/balance
URL Parameters:
- domain_id (string, required) - ID for the domain of the request
- asset_id (string, required) - ID for the asset of the request
- client_extid (string, required) - Your user id parameter, url-safe encoded
- key (string, required) - Domain security key (green or blue)
Example Reply:
{
"domain_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c6",
"client_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c8",
"client_extid": "client1",
"asset_id": "f3ff64a2-8675-4e26-9338-d0ad8f947289",
"amount": 88,
"last_calculated": 1652822237
}
- amount (integer) - The client's balance of the given asset
- last_calculated (integer) - Unix timestamp of the last time the balance was updated (likely the last block committed)
Transact
Add a transaction to the blockchain (increment or decrement a client's balance)
Endpoint:
- https://doubleloon.com/api/transact
URL Parameters:
- domain_id (string, required) - ID for the domain of the request
- asset_id (string, required) - ID for the asset of the request
- client_extid (string, required) - Your user id parameter, url-safe encoded
- key (string, required) - Domain security key (green or blue)
- amount (integer, required) - Amount of transaction (- for decrement)
- txid (string, required) - Your internal transaction id or comment
Example Reply:
{
"domain_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c6",
"asset_id": "f3ff64a2-8675-4e26-9338-d0ad8f947289",
"client_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c8",
"client_extid": "client1",
"when": 1652822233,
"amount": 11,
"comment": {
"txid": "123"
},
"_id": "628410d988ebc23a9f06f7f1"
}
- _id (string) - The id of the pending blockchain block
- when (integer) - Unix timestamp of when the block was added to the blockchain
Transactions
Get a customer's transactions
Endpoint:
- https://doubleloon.com/api/transactions
URL Parameters:
- domain_id (string, required) - ID for the domain of the request
- asset_id (string, required) - ID for the asset of the request
- client_extid (string, required) - Your user id parameter, url-safe encoded
- key (string, required) - Domain security key (green or blue)
- limit (integer, optional) - Maximum number of committed transactions to return (all pending ones will be returned)
Example Reply:
{
"pending": [],
"committed": [
{
"_id": "628410dd25fdf1e15b0c3122",
"_id_orig": "628410d988ebc23a9f06f7f1",
"domain_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c6",
"asset_id": "f3ff64a2-8675-4e26-9338-d0ad8f947289",
"client_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c8",
"client_extid": "client1",
"amount": 11,
"when": 1652822233,
"comment": {
"txid": "123"
},
"prev_block": "628410ad0ab26f52140603c3",
"prev_hash": "6885920e60ca76204698dd3073d1460e"
},
]
}
- _id (string) - The id of the block in the pending or committed blockchain
- _id_orig (string, committed only) - The ID of this block's pending block in the blockchain
- prev_block (string, committed only) - The ID of this block's parent block in the blockchain
- prev_hash (string, committed only) - The hash of this block's parent block in the blockchain
- when (integer) - Unix timestamp of when the block was added to the pending blockchain
Package Levels
Describe a package's levels
Endpoint:
- https://doubleloon.com/api/package-levels
URL Parameters:
- domain_id (string, required) - ID for the domain of the request
- asset_id (string, required) - ID for the asset of the request
- key (string, required) - Domain security key (green or blue)
Example Reply:
[
{
"domain_id": "ea968482-f2bf-4f7b-9906-b2213b1f41c6",
"asset_id": "f3ff64a2-8675-4e26-9338-d0ad8f947289",
"level_id": "e26fb64b-e64f-4f29-a59b-cefc89565e3c",
"sort_order": 1,
"name": "Default Package",
"from_amt": 1,
"to_asset": 1
}
]
- sort_order (integer) - The order you've asked for them to be sorted
- name (string) - The text describing the level of this package
- from_amt (integer) - The amount you're taking in (e.x. in USD)
- to_asset (integer) - The amount you're adding to the client's balance
Errors
Wrong domain_id/key/asset_id/client_id combo
To prevent harvesting, we can't tell you exactly what input was incorrect, please validate your parameters using the domain and asset endpoints
{
"name": "Unauthorized",
"message": "",
"code": 0,
"status": 401,
"type": "yii\\web\\UnauthorizedHttpException"
}
- Return Code: 401 Unauthorized
Insufficient balance
A transaction was sent that would move the client's balance below zero
{
"name": "Payment Required",
"message": "Insufficient Balance",
"code": 0,
"status": 402,
"type": "yii\\web\\HttpException"
}
- Return Code: 402 Payment Required