Accounts

Accounts #

The sections below demonstrate how to solve common book keeping problems revolving around the Account resource.

Chronological Transactions #

Problem #

You want to view all the Transactions in the order that they were recorded for the Account.

Solution #

Account Statement #

The Transactions recorded for the Account can be retrieved by calling the Account Statement Endpoint.

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/statement'
import requests

url = "https://api.microbooks.io/books/v1/account/1/statement"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/statement',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/statement', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/statement");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Variants #

Period Account Statement #

You can restrict the period to include in the Account Statement by specifying the Start and End dates. The Statement will include an Opening Balance, which is the balance as at the Start date and a closing Balance which is the balance as at the End date.

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/statement?start-date=2022-04-01&end-date=2022-04-30'
import requests

url = "https://api.microbooks.io/books/v1/account/1/statement?start-date=2022-04-01&end-date=2022-04-30"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/statement?start-date=2022-04-01&end-date=2022-04-30',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/statement?start-date=2022-04-01&end-date=2022-04-30', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/statement?start-date=2022-04-01&end-date=2022-04-30");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Currency Account Statement #

You can restrict the Currency of the Transactions to include in the Account Statement by specifying the Currency id.

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/statement?currency-id=1'
import requests

url = "https://api.microbooks.io/books/v1/account/1/statement?currency-id=1"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/statement?start-date=2022-04-01&end-date=2022-04-30',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/statement?currency-id=1', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/statement?currency-id=1");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Outstanding Transactions #

Problem #

You want to view the Transactions contribute to the balance the Account.

Solution #

Account Schedule #

The outstanding Transactions of the Account can be retrieved by calling the Account Schedule Endpoint. This retrieves only those Transactions whose outstanding amounts add up to the closing balance of the Account, net of any clearances.

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/schedule'
import requests

url = "https://api.microbooks.io/books/v1/account/1/schedule"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/schedule',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/schedule', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/schedule");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Variants #

Period Account Schedule #

You can restrict the period to include in the Account Schedule by specifying and End dates. The Schedule will only include the Transactions that add up to the balance as at the End date.

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/schedule?end-date=2022-04-30'
import requests

url = "https://api.microbooks.io/books/v1/account/1/schedule?end-date=2022-04-30"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/schedule?end-date=2022-04-30',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/schedule?end-date=2022-04-30', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/schedule?end-date=2022-04-30");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Currency Account Schedule #

You can restrict the Currency of the Transactions to include in the Account Schedule by specifying the Currency id.

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/schedule?currency-id=1'
import requests

url = "https://api.microbooks.io/books/v1/account/1/schedule?currency-id=1"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/schedule?end-date=2022-04-30',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/schedule?currency-id=1', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/schedule?currency-id=1");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Aged Account Balances #

Problem #

You want to view the balances of Receivable and Payable Accounts, distributed by how long they have been outstanding.

Solution #

Aging Schedule #

The balances of Accounts placed into buckets of how long they have been outstanding can be retrieved by calling the Aging Schedule Endpoint. The Aging Schedule is only available for Receivable and Payables

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/aging'
import requests

url = "https://api.microbooks.io/books/v1/account/1/aging"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/aging',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/aging', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/aging");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Variants #

Period Aging Schedule #

You can restrict the period to include in the Aging Schedule by specifying and End date. The Schedule will only include the balances as at the End date.

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/aging?end-date=2022-04-30'
import requests

url = "https://api.microbooks.io/books/v1/account/1/aging?end-date=2022-04-30"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/aging?end-date=2022-04-30',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/aging?end-date=2022-04-30', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/aging?end-date=2022-04-30");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Currency Aging Schedule #

You can restrict the Currency of the balances to include in the Aging Schedule by specifying the Currency id.

Request #

curl --location --request GET 'https://api.microbooks.io/books/v1/account/1/aging?currency-id=1'
import requests

url = "https://api.microbooks.io/books/v1/account/1/aging?currency-id=1"
body = {}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("GET", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'GET',
    'url': 'https://api.microbooks.io/books/v1/account/1/aging?end-date=2022-04-30',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{}'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = null;
$request = new Request('GET', 'https://api.microbooks.io/books/v1/account/1/aging?currency-id=1', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/account/1/aging?currency-id=1");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
var body = null;
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);