Banker JSON API

mikeburkat edited this page Jul 23, 2015 · 10 revisions

parameters should be specified as URL query e.g.

POST /v1/accounts?accountType=budget&accountName=helloworld

GET /
The command returns the list of available commands in JSON format. This can be used as a reference card for basic commands as it is easily readable by a human.
GET /ping
This command enables to check whether the Banker service is available via HTTP. When everything is running, the response will be an immediate "pong".
GET /v1/accounts

This command returns the hierachical list of available accounts as a JSON array of arrays of strings.

parameters:
maxDepth:
an integer describing the maximum length at which keys will be sought (default: unlimited)
accountPrefix:
a string that specifies the prefix against which the returned account names will be matched
POST /v1/accounts

This command is used to create a new account in the Banker database.

parameters:
accountType:
a string describing the account type to be created ("spend" or "budget")
accountName:
a string describing the account name to be created
GET /v1/accounts/<accountName>
This command returns a representation of the given account.
POST,PUT /v1/accounts/<accountName>/balance

Transfer budget to or from the parent such that the account's balance amount matches the amount passed in the request body. Note that by definition this method is only valid for sub accounts.

body:

The body for that command must contain an amount encoded in a JSON Object. For example:

"{ "USD/1M": 123456 }" (123456 micro USD)
parameters:
accountType:
If the account does not exist, this parameter defines the type of account to be created ("spend" or "budget")
POST,PUT /v1/accounts/<accountName>/budget
Set the budget of the account to the amount passed in the request body. Note that by definition this method is only valid for top accounts.
GET /v1/accounts/<accountName>/children

This command returns the list of children for the account specified by "accountName".

parameters:
depth:
an integer describing the maximum length at which keys will be sought (default: unlimited)
POST,PUT /v1/accounts/<accountName>/shadow

This command enables the update of the corresponding spend account's spend and commitments.

body:
The body for that command must contain a representation of the shadow account in JSON.
GET /v1/accounts/<accountName>/subtree

This command returns a representation of the given account and its children.

parameters:
depth:
an integer describing the maximum length at which keys will be sought (default: unlimited)
GET /v1/accounts/<accountName>/close
This command closes an account and all of its child accounts. When an account is closed it returns the remainder of its balance to its parent account. Closed accounts are archived under the banker:archive set in the redis database and will not be loaded into memory on the next MasterBanker restart. One can check on the number of accounts in the MasterBanker by looking under the masterBanker.accounts key in graphite.
GET /v1/accounts/<accountName>/summary

This command returns a JSON-encoded and aggregated summary of the given account and its children.

parameters:
maxDepth:
an integer describing the maximum length at which keys will be sought (default: unlimited)
GET /v1/summary
This command returns the simplified summaries of all existing accounts in a JSON-encoded format.
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.