Chilkat Online Tools

DataFlex / New FreshBooks / Balance Sheet

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sAmount
    String sCode
    String sDate
    String sAccount_type
    String sCategory
    Integer j
    Integer iCount_j
    String sAccount_name
    String sAccount_number
    Integer k
    Integer iCount_k
    String sBalanceAmount
    String sBalanceCode
    String sSub_account_name
    String sSub_account_number
    Variant vJson1
    Handle hoJson1
    Integer iI1
    Integer iCount_i1
    String sStrVal
    String sCompany_name
    String sCurrency_code
    String sDownload_token
    Integer i
    Integer iCount_i
    String sTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    Get ComUpdateString Of hoQueryParams "dates[]" "2019-04-19" To iSuccess
    Get ComUpdateString Of hoQueryParams "dates[]" "2019-04-25" To iSuccess
    Get ComUpdateString Of hoQueryParams "currency_code" "USD" To iSuccess

    // Adds the "Authorization: Bearer <access_token>" header.
    Set ComAuthToken Of hoHttp To "<access_token>"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://api.freshbooks.com/accounting/account/{{accountId}}/reports/accounting/balance_sheet" vQueryParams To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

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

    // {
    //   "response": {
    //     "result": {
    //       "balance_sheet": {
    //         "assets_total": [
    //           {
    //             "balance": {
    //               "amount": "-1380.98",
    //               "code": "USD"
    //             },
    //             "date": "2019-04-19"
    //           },
    //           {
    //             "balance": {
    //               "amount": "10345.56",
    //               "code": "USD"
    //             },
    //             "date": "2019-04-25"
    //           }
    //         ],
    //         "company_name": "Postman Sandbox",
    //         "currency_code": "USD",
    //         "data": [
    //           {
    //             "account_type": "asset",
    //             "accounts": [
    //               {
    //                 "account_name": "Cash",
    //                 "account_number": "1000",
    //                 "balances": [
    //                   {
    //                     "balance": {
    //                       "amount": "5744.02",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-19"
    //                   },
    //                   {
    //                     "balance": {
    //                       "amount": "6310.56",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-25"
    //                   }
    //                 ],
    //                 "sub_accounts": [
    //                   {
    //                     "balances": [
    //                       {
    //                         "balance": {
    //                           "amount": "5744.02",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-19"
    //                       },
    //                       {
    //                         "balance": {
    //                           "amount": "6310.56",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-25"
    //                       }
    //                     ],
    //                     "sub_account_name": "Petty Cash",
    //                     "sub_account_number": "1"
    //                   }
    //                 ]
    //               },
    //               {
    //                 "account_name": "Accounts Receivable",
    //                 "account_number": "1200",
    //                 "balances": [
    //                   {
    //                     "balance": {
    //                       "amount": "-7125.00",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-19"
    //                   },
    //                   {
    //                     "balance": {
    //                       "amount": "4035.00",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-25"
    //                   }
    //                 ],
    //                 "sub_accounts": [
    //                   {
    //                     "balances": [
    //                       {
    //                         "balance": {
    //                           "amount": "-7125.00",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-19"
    //                       },
    //                       {
    //                         "balance": {
    //                           "amount": "4435.00",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-25"
    //                       }
    //                     ],
    //                     "sub_account_name": "Accounts Receivable",
    //                     "sub_account_number": "1"
    //                   },
    //                   {
    //                     "balances": [
    //                       {
    //                         "balance": {
    //                           "amount": "0.00",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-19"
    //                       },
    //                       {
    //                         "balance": {
    //                           "amount": "-400.00",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-25"
    //                       }
    //                     ],
    //                     "sub_account_name": "Customer Deposits",
    //                     "sub_account_number": "2"
    //                   }
    //                 ]
    //               }
    //             ],
    //             "balances": [
    //               {
    //                 "balance": {
    //                   "amount": "-1380.98",
    //                   "code": "USD"
    //                 },
    //                 "date": "2019-04-19"
    //               },
    //               {
    //                 "balance": {
    //                   "amount": "10345.56",
    //                   "code": "USD"
    //                 },
    //                 "date": "2019-04-25"
    //               }
    //             ],
    //             "category": "current"
    //           },
    //           {
    //             "account_type": "liability",
    //             "accounts": [
    //               {
    //                 "account_name": "Taxes Payable",
    //                 "account_number": "2001",
    //                 "balances": [
    //                   {
    //                     "balance": {
    //                       "amount": "205.00",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-19"
    //                   },
    //                   {
    //                     "balance": {
    //                       "amount": "211.00",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-25"
    //                   }
    //                 ],
    //                 "sub_accounts": [
    //                   {
    //                     "balances": [
    //                       {
    //                         "balance": {
    //                           "amount": "205.00",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-19"
    //                       },
    //                       {
    //                         "balance": {
    //                           "amount": "211.00",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-25"
    //                       }
    //                     ],
    //                     "sub_account_name": "HST",
    //                     "sub_account_number": "1"
    //                   }
    //                 ]
    //               },
    //               {
    //                 "account_name": "Customer Credit",
    //                 "account_number": "2003",
    //                 "balances": [
    //                   {
    //                     "balance": {
    //                       "amount": "3120.00",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-19"
    //                   },
    //                   {
    //                     "balance": {
    //                       "amount": "3120.00",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-25"
    //                   }
    //                 ],
    //                 "sub_accounts": [
    //                   {
    //                     "balances": [
    //                       {
    //                         "balance": {
    //                           "amount": "3120.00",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-19"
    //                       },
    //                       {
    //                         "balance": {
    //                           "amount": "3120.00",
    //                           "code": "USD"
    //                         },
    //                         "date": "2019-04-25"
    //                       }
    //                     ],
    //                     "sub_account_name": "Customer Credit",
    //                     "sub_account_number": "1"
    //                   }
    //                 ]
    //               }
    //             ],
    //             "balances": [
    //               {
    //                 "balance": {
    //                   "amount": "3325.00",
    //                   "code": "USD"
    //                 },
    //                 "date": "2019-04-19"
    //               },
    //               {
    //                 "balance": {
    //                   "amount": "3331.00",
    //                   "code": "USD"
    //                 },
    //                 "date": "2019-04-25"
    //               }
    //             ],
    //             "category": "current"
    //           },
    //           {
    //             "account_type": "equity",
    //             "accounts": [
    //               {
    //                 "account_name": "Net Income",
    //                 "account_number": null,
    //                 "balances": [
    //                   {
    //                     "balance": {
    //                       "amount": "-4705.98",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-19"
    //                   },
    //                   {
    //                     "balance": {
    //                       "amount": "7014.56",
    //                       "code": "USD"
    //                     },
    //                     "date": "2019-04-25"
    //                   }
    //                 ],
    //                 "sub_accounts": [
    //                 ]
    //               }
    //             ],
    //             "balances": [
    //               {
    //                 "balance": {
    //                   "amount": "-4705.98",
    //                   "code": "USD"
    //                 },
    //                 "date": "2019-04-19"
    //               },
    //               {
    //                 "balance": {
    //                   "amount": "7014.56",
    //                   "code": "USD"
    //                 },
    //                 "date": "2019-04-25"
    //               }
    //             ],
    //             "category": null
    //           }
    //         ],
    //         "dates": [
    //           "2019-04-19",
    //           "2019-04-25"
    //         ],
    //         "download_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50aWQiOiJ3a01kMmciLCJ1c2VyaWQiOjEsImNvbnRhY3RpZCI6LTEsImxldmVsIjozLCJ0eXBlIjoicmVwb3J0Iiwib2JqZWN0aWQiOiJiYWxhbmNlX3NoZWV0IiwicGFyYW1zIjp7ImRhdGVzIjpbIjIwMTktMDQtMTkiLCIyMDE5LTA0LTI1Il0sImN1cnJlbmN5X2NvZGUiOiJVU0QifSwiaWF0IjoxNTU2MTMwNzAzLCJleHAiOjE1NTg3MjI3MDN9.FziuxTK2nbj1xfrefdPjL9J7_a5tFjBneqTp5juy4D0",
    //         "liabilities_and_equity_total": [
    //           {
    //             "balance": {
    //               "amount": "-1380.98",
    //               "code": "USD"
    //             },
    //             "date": "2019-04-19"
    //           },
    //           {
    //             "balance": {
    //               "amount": "10345.56",
    //               "code": "USD"
    //             },
    //             "date": "2019-04-25"
    //           }
    //         ]
    //       }
    //     }
    //   }
    // }

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

    Get ComStringOf Of hoJResp "response.result.balance_sheet.company_name" To sCompany_name
    Get ComStringOf Of hoJResp "response.result.balance_sheet.currency_code" To sCurrency_code
    Get ComStringOf Of hoJResp "response.result.balance_sheet.download_token" To sDownload_token
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "response.result.balance_sheet.assets_total" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "response.result.balance_sheet.assets_total[i].balance.amount" To sAmount
        Get ComStringOf Of hoJResp "response.result.balance_sheet.assets_total[i].balance.code" To sCode
        Get ComStringOf Of hoJResp "response.result.balance_sheet.assets_total[i].date" To sDate
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "response.result.balance_sheet.data" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].account_type" To sAccount_type
        Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].category" To sCategory
        Move 0 To j
        Get ComSizeOfArray Of hoJResp "response.result.balance_sheet.data[i].accounts" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].accounts[j].account_name" To sAccount_name
            Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].accounts[j].account_number" To sAccount_number
            Move 0 To k
            Get ComSizeOfArray Of hoJResp "response.result.balance_sheet.data[i].accounts[j].balances" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJResp To k
                Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].accounts[j].balances[k].balance.amount" To sBalanceAmount
                Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].accounts[j].balances[k].balance.code" To sBalanceCode
                Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].accounts[j].balances[k].date" To sDate
                Move (k + 1) To k
            Loop

            Move 0 To k
            Get ComSizeOfArray Of hoJResp "response.result.balance_sheet.data[i].accounts[j].sub_accounts" To iCount_k
            While (k < iCount_k)
                Set ComK Of hoJResp To k
                Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].accounts[j].sub_accounts[k].sub_account_name" To sSub_account_name
                Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].accounts[j].sub_accounts[k].sub_account_number" To sSub_account_number

                Get ComObjectOf Of hoJResp "response.result.balance_sheet.data[i].accounts[j].sub_accounts[k]" To vJson1
                If (IsComObject(vJson1)) Begin
                    Get Create (RefClass(cComChilkatJsonObject)) To hoJson1
                    Set pvComObject Of hoJson1 To vJson1
                End
                Move 0 To iI1
                Get ComSizeOfArray Of hoJson1 "balances" To iCount_i1
                While (iI1 < iCount_i1)
                    Set ComI Of hoJson1 To iI1
                    Get ComStringOf Of hoJson1 "balances[i].balance.amount" To sBalanceAmount
                    Get ComStringOf Of hoJson1 "balances[i].balance.code" To sBalanceCode
                    Get ComStringOf Of hoJson1 "balances[i].date" To sDate
                    Move (iI1 + 1) To iI1
                Loop

                Send Destroy of hoJson1
                Move (k + 1) To k
            Loop

            Move (j + 1) To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJResp "response.result.balance_sheet.data[i].balances" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJResp To j
            Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].balances[j].balance.amount" To sBalanceAmount
            Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].balances[j].balance.code" To sBalanceCode
            Get ComStringOf Of hoJResp "response.result.balance_sheet.data[i].balances[j].date" To sDate
            Move (j + 1) To j
        Loop

        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "response.result.balance_sheet.dates" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "response.result.balance_sheet.dates[i]" To sStrVal
        Move (i + 1) To i
    Loop

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "response.result.balance_sheet.liabilities_and_equity_total" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "response.result.balance_sheet.liabilities_and_equity_total[i].balance.amount" To sBalanceAmount
        Get ComStringOf Of hoJResp "response.result.balance_sheet.liabilities_and_equity_total[i].balance.code" To sBalanceCode
        Get ComStringOf Of hoJResp "response.result.balance_sheet.liabilities_and_equity_total[i].date" To sDate
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -G -d "dates[]=2019-04-19"
	-d "dates[]=2019-04-25"
	-d "currency_code=USD"
	-H "Authorization: Bearer <access_token>"
https://api.freshbooks.com/accounting/account/{{accountId}}/reports/accounting/balance_sheet

Postman Collection Item JSON

{
  "name": "Balance Sheet",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/reports/accounting/balance_sheet?dates[]=2019-04-19&dates[]=2019-04-25&currency_code=USD",
      "protocol": "https",
      "host": [
        "api",
        "freshbooks",
        "com"
      ],
      "path": [
        "accounting",
        "account",
        "{{accountId}}",
        "reports",
        "accounting",
        "balance_sheet"
      ],
      "query": [
        {
          "key": "dates[]",
          "value": "2019-04-19",
          "description": "will need to explain [] as anything before this date"
        },
        {
          "key": "dates[]",
          "value": "2019-04-25"
        },
        {
          "key": "currency_code",
          "value": "USD"
        }
      ]
    },
    "description": "A snapshot of your company's assets, liabilities and equity at any given point in time."
  },
  "response": [
    {
      "name": "Balance Sheet",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/reports/accounting/balance_sheet?dates[]=2019-04-19&dates[]=2019-04-25&currency_code=USD",
          "protocol": "https",
          "host": [
            "api",
            "freshbooks",
            "com"
          ],
          "path": [
            "accounting",
            "account",
            "{{accountId}}",
            "reports",
            "accounting",
            "balance_sheet"
          ],
          "query": [
            {
              "key": "dates[]",
              "value": "2019-04-19",
              "description": "will need to explain [] as anything before this date"
            },
            {
              "key": "dates[]",
              "value": "2019-04-25"
            },
            {
              "key": "currency_code",
              "value": "USD"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "X-NewRelic-App-Data",
          "value": "PxQBWV5TCBABVlVSAwEOVlcTGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4DFVdfRgFPCkNFR0gWVEZcEBIQWFEBWw1NVkBbXQJLBEEOQRYXFBtRSlMWAwlcU1QFAgZWVAMOA1VQUlUcTwlOGg5VB1dVAAMBUlEHUgBRBwdBFFVRCBIHag=="
        },
        {
          "key": "Access-Control-Allow-Origin",
          "value": "*"
        },
        {
          "key": "Expires",
          "value": "Tue, 24 Apr 2018 18:31:43 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": "Accept-Ranges",
          "value": "bytes"
        },
        {
          "key": "Accept-Ranges",
          "value": "bytes"
        },
        {
          "key": "Age",
          "value": "0"
        },
        {
          "key": "Age",
          "value": "0"
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        },
        {
          "key": "Date",
          "value": "Wed, 24 Apr 2019 18:31:43 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            \"balance_sheet\": {\n                \"assets_total\": [\n                    {\n                        \"balance\": {\n                            \"amount\": \"-1380.98\",\n                            \"code\": \"USD\"\n                        },\n                        \"date\": \"2019-04-19\"\n                    },\n                    {\n                        \"balance\": {\n                            \"amount\": \"10345.56\",\n                            \"code\": \"USD\"\n                        },\n                        \"date\": \"2019-04-25\"\n                    }\n                ],\n                \"company_name\": \"Postman Sandbox\",\n                \"currency_code\": \"USD\",\n                \"data\": [\n                    {\n                        \"account_type\": \"asset\",\n                        \"accounts\": [\n                            {\n                                \"account_name\": \"Cash\",\n                                \"account_number\": \"1000\",\n                                \"balances\": [\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"5744.02\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-19\"\n                                    },\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"6310.56\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-25\"\n                                    }\n                                ],\n                                \"sub_accounts\": [\n                                    {\n                                        \"balances\": [\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"5744.02\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-19\"\n                                            },\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"6310.56\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-25\"\n                                            }\n                                        ],\n                                        \"sub_account_name\": \"Petty Cash\",\n                                        \"sub_account_number\": \"1\"\n                                    }\n                                ]\n                            },\n                            {\n                                \"account_name\": \"Accounts Receivable\",\n                                \"account_number\": \"1200\",\n                                \"balances\": [\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"-7125.00\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-19\"\n                                    },\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"4035.00\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-25\"\n                                    }\n                                ],\n                                \"sub_accounts\": [\n                                    {\n                                        \"balances\": [\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"-7125.00\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-19\"\n                                            },\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"4435.00\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-25\"\n                                            }\n                                        ],\n                                        \"sub_account_name\": \"Accounts Receivable\",\n                                        \"sub_account_number\": \"1\"\n                                    },\n                                    {\n                                        \"balances\": [\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"0.00\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-19\"\n                                            },\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"-400.00\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-25\"\n                                            }\n                                        ],\n                                        \"sub_account_name\": \"Customer Deposits\",\n                                        \"sub_account_number\": \"2\"\n                                    }\n                                ]\n                            }\n                        ],\n                        \"balances\": [\n                            {\n                                \"balance\": {\n                                    \"amount\": \"-1380.98\",\n                                    \"code\": \"USD\"\n                                },\n                                \"date\": \"2019-04-19\"\n                            },\n                            {\n                                \"balance\": {\n                                    \"amount\": \"10345.56\",\n                                    \"code\": \"USD\"\n                                },\n                                \"date\": \"2019-04-25\"\n                            }\n                        ],\n                        \"category\": \"current\"\n                    },\n                    {\n                        \"account_type\": \"liability\",\n                        \"accounts\": [\n                            {\n                                \"account_name\": \"Taxes Payable\",\n                                \"account_number\": \"2001\",\n                                \"balances\": [\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"205.00\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-19\"\n                                    },\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"211.00\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-25\"\n                                    }\n                                ],\n                                \"sub_accounts\": [\n                                    {\n                                        \"balances\": [\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"205.00\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-19\"\n                                            },\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"211.00\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-25\"\n                                            }\n                                        ],\n                                        \"sub_account_name\": \"HST\",\n                                        \"sub_account_number\": \"1\"\n                                    }\n                                ]\n                            },\n                            {\n                                \"account_name\": \"Customer Credit\",\n                                \"account_number\": \"2003\",\n                                \"balances\": [\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"3120.00\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-19\"\n                                    },\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"3120.00\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-25\"\n                                    }\n                                ],\n                                \"sub_accounts\": [\n                                    {\n                                        \"balances\": [\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"3120.00\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-19\"\n                                            },\n                                            {\n                                                \"balance\": {\n                                                    \"amount\": \"3120.00\",\n                                                    \"code\": \"USD\"\n                                                },\n                                                \"date\": \"2019-04-25\"\n                                            }\n                                        ],\n                                        \"sub_account_name\": \"Customer Credit\",\n                                        \"sub_account_number\": \"1\"\n                                    }\n                                ]\n                            }\n                        ],\n                        \"balances\": [\n                            {\n                                \"balance\": {\n                                    \"amount\": \"3325.00\",\n                                    \"code\": \"USD\"\n                                },\n                                \"date\": \"2019-04-19\"\n                            },\n                            {\n                                \"balance\": {\n                                    \"amount\": \"3331.00\",\n                                    \"code\": \"USD\"\n                                },\n                                \"date\": \"2019-04-25\"\n                            }\n                        ],\n                        \"category\": \"current\"\n                    },\n                    {\n                        \"account_type\": \"equity\",\n                        \"accounts\": [\n                            {\n                                \"account_name\": \"Net Income\",\n                                \"account_number\": null,\n                                \"balances\": [\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"-4705.98\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-19\"\n                                    },\n                                    {\n                                        \"balance\": {\n                                            \"amount\": \"7014.56\",\n                                            \"code\": \"USD\"\n                                        },\n                                        \"date\": \"2019-04-25\"\n                                    }\n                                ],\n                                \"sub_accounts\": []\n                            }\n                        ],\n                        \"balances\": [\n                            {\n                                \"balance\": {\n                                    \"amount\": \"-4705.98\",\n                                    \"code\": \"USD\"\n                                },\n                                \"date\": \"2019-04-19\"\n                            },\n                            {\n                                \"balance\": {\n                                    \"amount\": \"7014.56\",\n                                    \"code\": \"USD\"\n                                },\n                                \"date\": \"2019-04-25\"\n                            }\n                        ],\n                        \"category\": null\n                    }\n                ],\n                \"dates\": [\n                    \"2019-04-19\",\n                    \"2019-04-25\"\n                ],\n                \"download_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50aWQiOiJ3a01kMmciLCJ1c2VyaWQiOjEsImNvbnRhY3RpZCI6LTEsImxldmVsIjozLCJ0eXBlIjoicmVwb3J0Iiwib2JqZWN0aWQiOiJiYWxhbmNlX3NoZWV0IiwicGFyYW1zIjp7ImRhdGVzIjpbIjIwMTktMDQtMTkiLCIyMDE5LTA0LTI1Il0sImN1cnJlbmN5X2NvZGUiOiJVU0QifSwiaWF0IjoxNTU2MTMwNzAzLCJleHAiOjE1NTg3MjI3MDN9.FziuxTK2nbj1xfrefdPjL9J7_a5tFjBneqTp5juy4D0\",\n                \"liabilities_and_equity_total\": [\n                    {\n                        \"balance\": {\n                            \"amount\": \"-1380.98\",\n                            \"code\": \"USD\"\n                        },\n                        \"date\": \"2019-04-19\"\n                    },\n                    {\n                        \"balance\": {\n                            \"amount\": \"10345.56\",\n                            \"code\": \"USD\"\n                        },\n                        \"date\": \"2019-04-25\"\n                    }\n                ]\n            }\n        }\n    }\n}"
    }
  ]
}