Chilkat Online Tools

SQL Server / New FreshBooks / General Ledger

Back to Collection Items

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    -- Adds the "Authorization: Bearer <access_token>" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
    EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-Type', 'application/json'

    DECLARE @sbResponseBody int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT

    EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api.freshbooks.com/accounting/account/{{accountId}}/journal_entry_accounts/journal_entry_accounts', @sbResponseBody
    IF @success = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        RETURN
      END

    DECLARE @jResp int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jResp OUT

    EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
    EXEC sp_OASetProperty @jResp, 'EmitCompact', 0


    PRINT 'Response Body:'
    EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
    PRINT @sTmp0

    DECLARE @respStatusCode int
    EXEC sp_OAGetProperty @http, 'LastStatus', @respStatusCode OUT

    PRINT 'Response Status Code = ' + @respStatusCode
    IF @respStatusCode >= 400
      BEGIN

        PRINT 'Response Header:'
        EXEC sp_OAGetProperty @http, 'LastHeader', @sTmp0 OUT
        PRINT @sTmp0

        PRINT 'Failed.'
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @sbResponseBody
        EXEC @hr = sp_OADestroy @jResp
        RETURN
      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

    DECLARE @account_name nvarchar(4000)

    DECLARE @account_number nvarchar(4000)

    DECLARE @account_type nvarchar(4000)

    DECLARE @accountid int

    DECLARE @balance nvarchar(4000)

    DECLARE @currency_code nvarchar(4000)

    DECLARE @id int

    DECLARE @j int

    DECLARE @count_j int

    DECLARE @account_sub_name nvarchar(4000)

    DECLARE @account_sub_number nvarchar(4000)

    DECLARE @custom int

    DECLARE @parentid int

    DECLARE @sub_accountid int

    DECLARE @Page int
    EXEC sp_OAMethod @jResp, 'IntOf', @Page OUT, 'response.result.page'
    DECLARE @Pages int
    EXEC sp_OAMethod @jResp, 'IntOf', @Pages OUT, 'response.result.pages'
    DECLARE @Per_page int
    EXEC sp_OAMethod @jResp, 'IntOf', @Per_page OUT, 'response.result.per_page'
    DECLARE @Total int
    EXEC sp_OAMethod @jResp, 'IntOf', @Total OUT, 'response.result.total'
    DECLARE @i int
    SELECT @i = 0
    DECLARE @count_i int
    EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'response.result.journal_entry_accounts'
    WHILE @i < @count_i
      BEGIN
        EXEC sp_OASetProperty @jResp, 'I', @i
        EXEC sp_OAMethod @jResp, 'StringOf', @account_name OUT, 'response.result.journal_entry_accounts[i].account_name'
        EXEC sp_OAMethod @jResp, 'StringOf', @account_number OUT, 'response.result.journal_entry_accounts[i].account_number'
        EXEC sp_OAMethod @jResp, 'StringOf', @account_type OUT, 'response.result.journal_entry_accounts[i].account_type'
        EXEC sp_OAMethod @jResp, 'IntOf', @accountid OUT, 'response.result.journal_entry_accounts[i].accountid'
        EXEC sp_OAMethod @jResp, 'StringOf', @balance OUT, 'response.result.journal_entry_accounts[i].balance'
        EXEC sp_OAMethod @jResp, 'StringOf', @currency_code OUT, 'response.result.journal_entry_accounts[i].currency_code'
        EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'response.result.journal_entry_accounts[i].id'
        SELECT @j = 0
        EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_j OUT, 'response.result.journal_entry_accounts[i].sub_accounts'
        WHILE @j < @count_j
          BEGIN
            EXEC sp_OASetProperty @jResp, 'J', @j
            EXEC sp_OAMethod @jResp, 'StringOf', @account_sub_name OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].account_sub_name'
            EXEC sp_OAMethod @jResp, 'StringOf', @account_sub_number OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].account_sub_number'
            EXEC sp_OAMethod @jResp, 'StringOf', @account_type OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].account_type'
            EXEC sp_OAMethod @jResp, 'StringOf', @balance OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].balance'
            EXEC sp_OAMethod @jResp, 'StringOf', @currency_code OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].currency_code'
            EXEC sp_OAMethod @jResp, 'BoolOf', @custom OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].custom'
            EXEC sp_OAMethod @jResp, 'IntOf', @id OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].id'
            EXEC sp_OAMethod @jResp, 'IntOf', @parentid OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].parentid'
            EXEC sp_OAMethod @jResp, 'IntOf', @sub_accountid OUT, 'response.result.journal_entry_accounts[i].sub_accounts[j].sub_accountid'
            SELECT @j = @j + 1
          END
        SELECT @i = @i + 1
      END

    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @sbResponseBody
    EXEC @hr = sp_OADestroy @jResp


END
GO

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