Chilkat Online Tools

Ruby / New FreshBooks / General Ledger

Back to Collection Items

require 'chilkat'

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

http = Chilkat::CkHttp.new()

# Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>")
http.SetRequestHeader("Content-Type","application/json")

sbResponseBody = Chilkat::CkStringBuilder.new()
success = http.QuickGetSb("https://api.freshbooks.com/accounting/account/{{accountId}}/journal_entry_accounts/journal_entry_accounts",sbResponseBody)
if (success == false)
    print http.lastErrorText() + "\n";
    exit
end

jResp = Chilkat::CkJsonObject.new()
jResp.LoadSb(sbResponseBody)
jResp.put_EmitCompact(false)

print "Response Body:" + "\n";
print jResp.emit() + "\n";

respStatusCode = http.get_LastStatus()
print "Response Status Code = " + respStatusCode.to_s() + "\n";
if (respStatusCode >= 400)
    print "Response Header:" + "\n";
    print http.lastHeader() + "\n";
    print "Failed." + "\n";
    exit
end

# Sample JSON response:
# (Sample code for parsing the JSON response is shown below)

# {
#   "response": {
#     "result": {
#       "journal_entry_accounts": [
#         {
#           "account_name": "Cash",
#           "account_number": "1000",
#           "account_type": "asset",
#           "accountid": 545882,
#           "balance": "340.54",
#           "currency_code": "USD",
#           "id": 545882,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Petty Cash",
#               "account_sub_number": "1",
#               "account_type": "asset",
#               "balance": "340.54",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635972,
#               "parentid": 545882,
#               "sub_accountid": 635972
#             }
#           ]
#         },
#         {
#           "account_name": "Accounts Receivable",
#           "account_number": "1200",
#           "account_type": "asset",
#           "accountid": 545884,
#           "balance": "-500",
#           "currency_code": "USD",
#           "id": 545884,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Accounts Receivable",
#               "account_sub_number": "1",
#               "account_type": "asset",
#               "balance": "-500",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635974,
#               "parentid": 545884,
#               "sub_accountid": 635974
#             },
#             {
#               "account_sub_name": "Customer Deposits",
#               "account_sub_number": "2",
#               "account_type": "asset",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635976,
#               "parentid": 545884,
#               "sub_accountid": 635976
#             }
#           ]
#         },
#         {
#           "account_name": "Property, Plant, and Equipment",
#           "account_number": "1500",
#           "account_type": "asset",
#           "accountid": 545886,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545886,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Office Equipment",
#               "account_sub_number": "1",
#               "account_type": "asset",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635978,
#               "parentid": 545886,
#               "sub_accountid": 635978
#             },
#             {
#               "account_sub_name": "Furniture",
#               "account_sub_number": "2",
#               "account_type": "asset",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635980,
#               "parentid": 545886,
#               "sub_accountid": 635980
#             }
#           ]
#         },
#         {
#           "account_name": "Deferred Discounts",
#           "account_number": "1600",
#           "account_type": "asset",
#           "accountid": 545888,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545888,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Deferred Discounts",
#               "account_sub_number": "1",
#               "account_type": "asset",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635982,
#               "parentid": 545888,
#               "sub_accountid": 635982
#             }
#           ]
#         },
#         {
#           "account_name": "Accounts Payable",
#           "account_number": "2000",
#           "account_type": "liability",
#           "accountid": 545890,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545890,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Accrued Payroll",
#               "account_sub_number": "1",
#               "account_type": "liability",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635984,
#               "parentid": 545890,
#               "sub_accountid": 635984
#             },
#             {
#               "account_sub_name": "Accrued Rent",
#               "account_sub_number": "2",
#               "account_type": "liability",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635986,
#               "parentid": 545890,
#               "sub_accountid": 635986
#             }
#           ]
#         },
#         {
#           "account_name": "Taxes Payable",
#           "account_number": "2001",
#           "account_type": "liability",
#           "accountid": 545892,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545892,
#           "sub_accounts": [
#             {
#               "account_sub_name": "HST",
#               "account_sub_number": "1",
#               "account_type": "liability",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 636766,
#               "parentid": 545892,
#               "sub_accountid": 636766
#             }
#           ]
#         },
#         {
#           "account_name": "Unearned Revenue",
#           "account_number": "2002",
#           "account_type": "liability",
#           "accountid": 545894,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545894,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Unearned Revenue",
#               "account_sub_number": "1",
#               "account_type": "liability",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635988,
#               "parentid": 545894,
#               "sub_accountid": 635988
#             }
#           ]
#         },
#         {
#           "account_name": "Customer Credit",
#           "account_number": "2003",
#           "account_type": "liability",
#           "accountid": 545896,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545896,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Customer Credit",
#               "account_sub_number": "1",
#               "account_type": "liability",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635990,
#               "parentid": 545896,
#               "sub_accountid": 635990
#             }
#           ]
#         },
#         {
#           "account_name": "Credit Cards",
#           "account_number": "2004",
#           "account_type": "liability",
#           "accountid": 545898,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545898,
#           "sub_accounts": [
#           ]
#         },
#         {
#           "account_name": "Owner's Equity",
#           "account_number": "3000",
#           "account_type": "equity",
#           "accountid": 545900,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545900,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Owner's Equity",
#               "account_sub_number": "1",
#               "account_type": "equity",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635992,
#               "parentid": 545900,
#               "sub_accountid": 635992
#             },
#             {
#               "account_sub_name": "Common Stock",
#               "account_sub_number": "2",
#               "account_type": "equity",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635994,
#               "parentid": 545900,
#               "sub_accountid": 635994
#             },
#             {
#               "account_sub_name": "Retained Earnings",
#               "account_sub_number": "3",
#               "account_type": "equity",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635996,
#               "parentid": 545900,
#               "sub_accountid": 635996
#             }
#           ]
#         },
#         {
#           "account_name": "Opening Balance",
#           "account_number": "3001",
#           "account_type": "equity",
#           "accountid": 545902,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545902,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Opening Balance Adjustments",
#               "account_sub_number": "4",
#               "account_type": "equity",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 635998,
#               "parentid": 545902,
#               "sub_accountid": 635998
#             }
#           ]
#         },
#         {
#           "account_name": "Revenue",
#           "account_number": "4000",
#           "account_type": "income",
#           "accountid": 545904,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545904,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Sales",
#               "account_sub_number": "1",
#               "account_type": "income",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 636000,
#               "parentid": 545904,
#               "sub_accountid": 636000
#             },
#             {
#               "account_sub_name": "Billed Expenses",
#               "account_sub_number": "2",
#               "account_type": "income",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 636002,
#               "parentid": 545904,
#               "sub_accountid": 636002
#             },
#             {
#               "account_sub_name": "Discounts",
#               "account_sub_number": "3",
#               "account_type": "income",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 636004,
#               "parentid": 545904,
#               "sub_accountid": 636004
#             }
#           ]
#         },
#         {
#           "account_name": "Cost of Goods Sold",
#           "account_number": "5000",
#           "account_type": "expense",
#           "accountid": 545906,
#           "balance": "0",
#           "currency_code": "USD",
#           "id": 545906,
#           "sub_accounts": [
#           ]
#         },
#         {
#           "account_name": "Operating Expenses",
#           "account_number": "6000",
#           "account_type": "expense",
#           "accountid": 545908,
#           "balance": "141.12",
#           "currency_code": "USD",
#           "id": 545908,
#           "sub_accounts": [
#             {
#               "account_sub_name": "Other Expenses",
#               "account_sub_number": "1",
#               "account_type": "expense",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 636768,
#               "parentid": 545908,
#               "sub_accountid": 636768
#             },
#             {
#               "account_sub_name": "Rent or Lease",
#               "account_sub_number": "2",
#               "account_type": "expense",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 760282,
#               "parentid": 545908,
#               "sub_accountid": 760282
#             },
#             {
#               "account_sub_name": "Car & Truck Expenses",
#               "account_sub_number": "3",
#               "account_type": "expense",
#               "balance": "141.12",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 849638,
#               "parentid": 545908,
#               "sub_accountid": 849638
#             }
#           ]
#         },
#         {
#           "account_name": "Taxes Paid",
#           "account_number": "6001",
#           "account_type": "expense",
#           "accountid": 545910,
#           "balance": "18.34",
#           "currency_code": "USD",
#           "id": 545910,
#           "sub_accounts": [
#             {
#               "account_sub_name": "HST",
#               "account_sub_number": "1",
#               "account_type": "expense",
#               "balance": "0",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 636770,
#               "parentid": 545910,
#               "sub_accountid": 636770
#             },
#             {
#               "account_sub_name": "other tax",
#               "account_sub_number": "2",
#               "account_type": "expense",
#               "balance": "18.34",
#               "currency_code": "USD",
#               "custom": false,
#               "id": 849640,
#               "parentid": 545910,
#               "sub_accountid": 849640
#             }
#           ]
#         }
#       ],
#       "page": 1,
#       "pages": 1,
#       "per_page": 15,
#       "total": 15
#     }
#   }
# }

# Sample code for parsing the JSON response...
# Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

Page = jResp.IntOf("response.result.page")
Pages = jResp.IntOf("response.result.pages")
Per_page = jResp.IntOf("response.result.per_page")
Total = jResp.IntOf("response.result.total")
i = 0
count_i = jResp.SizeOfArray("response.result.journal_entry_accounts")
while i < count_i
    jResp.put_I(i)
    account_name = jResp.stringOf("response.result.journal_entry_accounts[i].account_name")
    account_number = jResp.stringOf("response.result.journal_entry_accounts[i].account_number")
    account_type = jResp.stringOf("response.result.journal_entry_accounts[i].account_type")
    accountid = jResp.IntOf("response.result.journal_entry_accounts[i].accountid")
    balance = jResp.stringOf("response.result.journal_entry_accounts[i].balance")
    currency_code = jResp.stringOf("response.result.journal_entry_accounts[i].currency_code")
    id = jResp.IntOf("response.result.journal_entry_accounts[i].id")
    j = 0
    count_j = jResp.SizeOfArray("response.result.journal_entry_accounts[i].sub_accounts")
    while j < count_j
        jResp.put_J(j)
        account_sub_name = jResp.stringOf("response.result.journal_entry_accounts[i].sub_accounts[j].account_sub_name")
        account_sub_number = jResp.stringOf("response.result.journal_entry_accounts[i].sub_accounts[j].account_sub_number")
        account_type = jResp.stringOf("response.result.journal_entry_accounts[i].sub_accounts[j].account_type")
        balance = jResp.stringOf("response.result.journal_entry_accounts[i].sub_accounts[j].balance")
        currency_code = jResp.stringOf("response.result.journal_entry_accounts[i].sub_accounts[j].currency_code")
        custom = jResp.BoolOf("response.result.journal_entry_accounts[i].sub_accounts[j].custom")
        id = jResp.IntOf("response.result.journal_entry_accounts[i].sub_accounts[j].id")
        parentid = jResp.IntOf("response.result.journal_entry_accounts[i].sub_accounts[j].parentid")
        sub_accountid = jResp.IntOf("response.result.journal_entry_accounts[i].sub_accounts[j].sub_accountid")
        j = j + 1
    end
    i = i + 1
end

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
https://api.freshbooks.com/accounting/account/{{accountId}}/journal_entry_accounts/journal_entry_accounts

Postman Collection Item JSON

{
  "name": "General Ledger",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/journal_entry_accounts/journal_entry_accounts",
      "protocol": "https",
      "host": [
        "api",
        "freshbooks",
        "com"
      ],
      "path": [
        "accounting",
        "account",
        "{{accountId}}",
        "journal_entry_accounts",
        "journal_entry_accounts"
      ],
      "query": [
        {
          "key": "search%5Bcurrency_code%5D",
          "value": "USD",
          "disabled": true
        },
        {
          "key": "search%5Bstart_date%5D",
          "value": "2019-04-01",
          "disabled": true
        },
        {
          "key": "search%5Bend_date%5D",
          "value": "2019-04-30",
          "disabled": true
        }
      ]
    },
    "description": "A complete record of your transactions to help you prepare financial statements."
  },
  "response": [
    {
      "name": "General Ledger",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/journal_entry_accounts/journal_entry_accounts",
          "protocol": "https",
          "host": [
            "api",
            "freshbooks",
            "com"
          ],
          "path": [
            "accounting",
            "account",
            "{{accountId}}",
            "journal_entry_accounts",
            "journal_entry_accounts"
          ],
          "query": [
            {
              "key": "search%5Bcurrency_code%5D",
              "value": "USD",
              "disabled": true
            },
            {
              "key": "search%5Bstart_date%5D",
              "value": "2019-04-01",
              "disabled": true
            },
            {
              "key": "search%5Bend_date%5D",
              "value": "2019-04-30",
              "disabled": true
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "X-NewRelic-App-Data",
          "value": "PxQBWV5TCBABVlVSAwEOVlcTGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4DFVdfRgFPCkNFR0gOXkNBDAcPPVUMTBBBZ1VRUApMD0USCQgLQ0UPBw9dXUQWGANUUlgTCkVFEU5WT1IeUwhUDwwFBgFdClYEUwdWVQIbTFdPGgUDU1hTBwYFAFUED1dQUwJAHARZDktdaQ=="
        },
        {
          "key": "Access-Control-Allow-Origin",
          "value": "*"
        },
        {
          "key": "Expires",
          "value": "Tue, 24 Apr 2018 18:32:11 GMT"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip"
        },
        {
          "key": "Via",
          "value": "1.1 google"
        },
        {
          "key": "Via",
          "value": "1.1 varnish"
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        },
        {
          "key": "Accept-Ranges",
          "value": "bytes"
        },
        {
          "key": "Date",
          "value": "Wed, 24 Apr 2019 18:32:11 GMT"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "X-Served-By",
          "value": "cache-mdw17369-MDW"
        },
        {
          "key": "X-Cache",
          "value": "MISS"
        },
        {
          "key": "X-Cache-Hits",
          "value": "0"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "Country",
          "value": "CA"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=31536000; includeSubDomains; preload"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"response\": {\n        \"result\": {\n            \"journal_entry_accounts\": [\n                {\n                    \"account_name\": \"Cash\",\n                    \"account_number\": \"1000\",\n                    \"account_type\": \"asset\",\n                    \"accountid\": 545882,\n                    \"balance\": \"340.54\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545882,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Petty Cash\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"asset\",\n                            \"balance\": \"340.54\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635972,\n                            \"parentid\": 545882,\n                            \"sub_accountid\": 635972\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Accounts Receivable\",\n                    \"account_number\": \"1200\",\n                    \"account_type\": \"asset\",\n                    \"accountid\": 545884,\n                    \"balance\": \"-500\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545884,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Accounts Receivable\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"asset\",\n                            \"balance\": \"-500\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635974,\n                            \"parentid\": 545884,\n                            \"sub_accountid\": 635974\n                        },\n                        {\n                            \"account_sub_name\": \"Customer Deposits\",\n                            \"account_sub_number\": \"2\",\n                            \"account_type\": \"asset\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635976,\n                            \"parentid\": 545884,\n                            \"sub_accountid\": 635976\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Property, Plant, and Equipment\",\n                    \"account_number\": \"1500\",\n                    \"account_type\": \"asset\",\n                    \"accountid\": 545886,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545886,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Office Equipment\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"asset\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635978,\n                            \"parentid\": 545886,\n                            \"sub_accountid\": 635978\n                        },\n                        {\n                            \"account_sub_name\": \"Furniture\",\n                            \"account_sub_number\": \"2\",\n                            \"account_type\": \"asset\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635980,\n                            \"parentid\": 545886,\n                            \"sub_accountid\": 635980\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Deferred Discounts\",\n                    \"account_number\": \"1600\",\n                    \"account_type\": \"asset\",\n                    \"accountid\": 545888,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545888,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Deferred Discounts\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"asset\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635982,\n                            \"parentid\": 545888,\n                            \"sub_accountid\": 635982\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Accounts Payable\",\n                    \"account_number\": \"2000\",\n                    \"account_type\": \"liability\",\n                    \"accountid\": 545890,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545890,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Accrued Payroll\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"liability\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635984,\n                            \"parentid\": 545890,\n                            \"sub_accountid\": 635984\n                        },\n                        {\n                            \"account_sub_name\": \"Accrued Rent\",\n                            \"account_sub_number\": \"2\",\n                            \"account_type\": \"liability\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635986,\n                            \"parentid\": 545890,\n                            \"sub_accountid\": 635986\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Taxes Payable\",\n                    \"account_number\": \"2001\",\n                    \"account_type\": \"liability\",\n                    \"accountid\": 545892,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545892,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"HST\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"liability\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 636766,\n                            \"parentid\": 545892,\n                            \"sub_accountid\": 636766\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Unearned Revenue\",\n                    \"account_number\": \"2002\",\n                    \"account_type\": \"liability\",\n                    \"accountid\": 545894,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545894,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Unearned Revenue\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"liability\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635988,\n                            \"parentid\": 545894,\n                            \"sub_accountid\": 635988\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Customer Credit\",\n                    \"account_number\": \"2003\",\n                    \"account_type\": \"liability\",\n                    \"accountid\": 545896,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545896,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Customer Credit\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"liability\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635990,\n                            \"parentid\": 545896,\n                            \"sub_accountid\": 635990\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Credit Cards\",\n                    \"account_number\": \"2004\",\n                    \"account_type\": \"liability\",\n                    \"accountid\": 545898,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545898,\n                    \"sub_accounts\": []\n                },\n                {\n                    \"account_name\": \"Owner's Equity\",\n                    \"account_number\": \"3000\",\n                    \"account_type\": \"equity\",\n                    \"accountid\": 545900,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545900,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Owner's Equity\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"equity\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635992,\n                            \"parentid\": 545900,\n                            \"sub_accountid\": 635992\n                        },\n                        {\n                            \"account_sub_name\": \"Common Stock\",\n                            \"account_sub_number\": \"2\",\n                            \"account_type\": \"equity\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635994,\n                            \"parentid\": 545900,\n                            \"sub_accountid\": 635994\n                        },\n                        {\n                            \"account_sub_name\": \"Retained Earnings\",\n                            \"account_sub_number\": \"3\",\n                            \"account_type\": \"equity\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635996,\n                            \"parentid\": 545900,\n                            \"sub_accountid\": 635996\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Opening Balance\",\n                    \"account_number\": \"3001\",\n                    \"account_type\": \"equity\",\n                    \"accountid\": 545902,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545902,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Opening Balance Adjustments\",\n                            \"account_sub_number\": \"4\",\n                            \"account_type\": \"equity\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 635998,\n                            \"parentid\": 545902,\n                            \"sub_accountid\": 635998\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Revenue\",\n                    \"account_number\": \"4000\",\n                    \"account_type\": \"income\",\n                    \"accountid\": 545904,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545904,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Sales\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"income\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 636000,\n                            \"parentid\": 545904,\n                            \"sub_accountid\": 636000\n                        },\n                        {\n                            \"account_sub_name\": \"Billed Expenses\",\n                            \"account_sub_number\": \"2\",\n                            \"account_type\": \"income\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 636002,\n                            \"parentid\": 545904,\n                            \"sub_accountid\": 636002\n                        },\n                        {\n                            \"account_sub_name\": \"Discounts\",\n                            \"account_sub_number\": \"3\",\n                            \"account_type\": \"income\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 636004,\n                            \"parentid\": 545904,\n                            \"sub_accountid\": 636004\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Cost of Goods Sold\",\n                    \"account_number\": \"5000\",\n                    \"account_type\": \"expense\",\n                    \"accountid\": 545906,\n                    \"balance\": \"0\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545906,\n                    \"sub_accounts\": []\n                },\n                {\n                    \"account_name\": \"Operating Expenses\",\n                    \"account_number\": \"6000\",\n                    \"account_type\": \"expense\",\n                    \"accountid\": 545908,\n                    \"balance\": \"141.12\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545908,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"Other Expenses\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"expense\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 636768,\n                            \"parentid\": 545908,\n                            \"sub_accountid\": 636768\n                        },\n                        {\n                            \"account_sub_name\": \"Rent or Lease\",\n                            \"account_sub_number\": \"2\",\n                            \"account_type\": \"expense\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 760282,\n                            \"parentid\": 545908,\n                            \"sub_accountid\": 760282\n                        },\n                        {\n                            \"account_sub_name\": \"Car & Truck Expenses\",\n                            \"account_sub_number\": \"3\",\n                            \"account_type\": \"expense\",\n                            \"balance\": \"141.12\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 849638,\n                            \"parentid\": 545908,\n                            \"sub_accountid\": 849638\n                        }\n                    ]\n                },\n                {\n                    \"account_name\": \"Taxes Paid\",\n                    \"account_number\": \"6001\",\n                    \"account_type\": \"expense\",\n                    \"accountid\": 545910,\n                    \"balance\": \"18.34\",\n                    \"currency_code\": \"USD\",\n                    \"id\": 545910,\n                    \"sub_accounts\": [\n                        {\n                            \"account_sub_name\": \"HST\",\n                            \"account_sub_number\": \"1\",\n                            \"account_type\": \"expense\",\n                            \"balance\": \"0\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 636770,\n                            \"parentid\": 545910,\n                            \"sub_accountid\": 636770\n                        },\n                        {\n                            \"account_sub_name\": \"other tax\",\n                            \"account_sub_number\": \"2\",\n                            \"account_type\": \"expense\",\n                            \"balance\": \"18.34\",\n                            \"currency_code\": \"USD\",\n                            \"custom\": false,\n                            \"id\": 849640,\n                            \"parentid\": 545910,\n                            \"sub_accountid\": 849640\n                        }\n                    ]\n                }\n            ],\n            \"page\": 1,\n            \"pages\": 1,\n            \"per_page\": 15,\n            \"total\": 15\n        }\n    }\n}"
    }
  ]
}