Chilkat Online Tools

DataFlex / New FreshBooks / Get System

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sAccountid
    Boolean iActive
    Integer iAuto_bill
    String sBilling_status
    String sBus_phone
    String sBusiness_type
    String sBusiness_uuid
    String sCity
    String sCode
    String sCountry
    String sCurrency_code
    String sDate
    String sDiscountid
    Boolean iDst
    Integer iDuration
    String sV_Email
    String sFax
    String sAmount
    String sGst_amountCode
    String sHeard_about_us_via
    Integer iId
    String sInfo_email
    String sIp
    String sLanding_url
    Boolean iMasterlock_billing
    String sMigrated_to_smux_at
    String sMob_phone
    Boolean iModern_system
    String sName
    String sNum_clients
    String sNum_staff
    String sPayment_amountAmount
    String sPayment_amountCode
    Integer iPayment_frequency
    String sProvince
    String sReferralid
    String sReferring_url
    String sSalutation
    String sSize_limit
    String sSplit_token
    String sStreet
    String sStreet2
    Integer iSystemid
    Boolean iTest_system
    String sTimezone
    Integer iTimezoneid
    String sVat_name
    String sVat_number
    String sTemp1

    // 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

    // Adds the "Authorization: Bearer <access_token>" header.
    Set ComAuthToken Of hoHttp To "<access_token>"
    Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://api.freshbooks.com/accounting/account/{{accountId}}/systems/systems/{{businessId}}" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    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 ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

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

    // {
    //   "response": {
    //     "result": {
    //       "system": {
    //         "accountid": "wkMd2g",
    //         "active": true,
    //         "auto_bill": 5,
    //         "billing_status": "uptodate",
    //         "bus_phone": "",
    //         "business_type": null,
    //         "business_uuid": null,
    //         "city": "",
    //         "code": "",
    //         "country": "Canada",
    //         "currency_code": "USD",
    //         "date": "2019-04-18 09:14:53",
    //         "discountid": null,
    //         "dst": true,
    //         "duration": 12,
    //         "email": "api.freshbooks@gmail.com",
    //         "fax": "",
    //         "gst_amount": {
    //           "amount": "0.00",
    //           "code": "USD"
    //         },
    //         "heard_about_us_via": null,
    //         "id": 4236410,
    //         "info_email": "api.freshbooks@gmail.com",
    //         "ip": "62.205.194.4",
    //         "landing_url": null,
    //         "masterlock_billing": true,
    //         "migrated_to_smux_at": null,
    //         "mob_phone": "",
    //         "modern_system": true,
    //         "name": "Postman Sandbox",
    //         "num_clients": null,
    //         "num_staff": null,
    //         "payment_amount": {
    //           "amount": "0.00",
    //           "code": "USD"
    //         },
    //         "payment_frequency": 1,
    //         "province": "",
    //         "referralid": "multibiz",
    //         "referring_url": null,
    //         "salutation": null,
    //         "size_limit": null,
    //         "split_token": null,
    //         "street": "",
    //         "street2": null,
    //         "systemid": 4236410,
    //         "test_system": false,
    //         "timezone": "UTC",
    //         "timezoneid": 14,
    //         "vat_name": null,
    //         "vat_number": null
    //       }
    //     }
    //   }
    // }

    // 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.system.accountid" To sAccountid
    Get ComBoolOf Of hoJResp "response.result.system.active" To iActive
    Get ComIntOf Of hoJResp "response.result.system.auto_bill" To iAuto_bill
    Get ComStringOf Of hoJResp "response.result.system.billing_status" To sBilling_status
    Get ComStringOf Of hoJResp "response.result.system.bus_phone" To sBus_phone
    Get ComStringOf Of hoJResp "response.result.system.business_type" To sBusiness_type
    Get ComStringOf Of hoJResp "response.result.system.business_uuid" To sBusiness_uuid
    Get ComStringOf Of hoJResp "response.result.system.city" To sCity
    Get ComStringOf Of hoJResp "response.result.system.code" To sCode
    Get ComStringOf Of hoJResp "response.result.system.country" To sCountry
    Get ComStringOf Of hoJResp "response.result.system.currency_code" To sCurrency_code
    Get ComStringOf Of hoJResp "response.result.system.date" To sDate
    Get ComStringOf Of hoJResp "response.result.system.discountid" To sDiscountid
    Get ComBoolOf Of hoJResp "response.result.system.dst" To iDst
    Get ComIntOf Of hoJResp "response.result.system.duration" To iDuration
    Get ComStringOf Of hoJResp "response.result.system.email" To sV_Email
    Get ComStringOf Of hoJResp "response.result.system.fax" To sFax
    Get ComStringOf Of hoJResp "response.result.system.gst_amount.amount" To sAmount
    Get ComStringOf Of hoJResp "response.result.system.gst_amount.code" To sGst_amountCode
    Get ComStringOf Of hoJResp "response.result.system.heard_about_us_via" To sHeard_about_us_via
    Get ComIntOf Of hoJResp "response.result.system.id" To iId
    Get ComStringOf Of hoJResp "response.result.system.info_email" To sInfo_email
    Get ComStringOf Of hoJResp "response.result.system.ip" To sIp
    Get ComStringOf Of hoJResp "response.result.system.landing_url" To sLanding_url
    Get ComBoolOf Of hoJResp "response.result.system.masterlock_billing" To iMasterlock_billing
    Get ComStringOf Of hoJResp "response.result.system.migrated_to_smux_at" To sMigrated_to_smux_at
    Get ComStringOf Of hoJResp "response.result.system.mob_phone" To sMob_phone
    Get ComBoolOf Of hoJResp "response.result.system.modern_system" To iModern_system
    Get ComStringOf Of hoJResp "response.result.system.name" To sName
    Get ComStringOf Of hoJResp "response.result.system.num_clients" To sNum_clients
    Get ComStringOf Of hoJResp "response.result.system.num_staff" To sNum_staff
    Get ComStringOf Of hoJResp "response.result.system.payment_amount.amount" To sPayment_amountAmount
    Get ComStringOf Of hoJResp "response.result.system.payment_amount.code" To sPayment_amountCode
    Get ComIntOf Of hoJResp "response.result.system.payment_frequency" To iPayment_frequency
    Get ComStringOf Of hoJResp "response.result.system.province" To sProvince
    Get ComStringOf Of hoJResp "response.result.system.referralid" To sReferralid
    Get ComStringOf Of hoJResp "response.result.system.referring_url" To sReferring_url
    Get ComStringOf Of hoJResp "response.result.system.salutation" To sSalutation
    Get ComStringOf Of hoJResp "response.result.system.size_limit" To sSize_limit
    Get ComStringOf Of hoJResp "response.result.system.split_token" To sSplit_token
    Get ComStringOf Of hoJResp "response.result.system.street" To sStreet
    Get ComStringOf Of hoJResp "response.result.system.street2" To sStreet2
    Get ComIntOf Of hoJResp "response.result.system.systemid" To iSystemid
    Get ComBoolOf Of hoJResp "response.result.system.test_system" To iTest_system
    Get ComStringOf Of hoJResp "response.result.system.timezone" To sTimezone
    Get ComIntOf Of hoJResp "response.result.system.timezoneid" To iTimezoneid
    Get ComStringOf Of hoJResp "response.result.system.vat_name" To sVat_name
    Get ComStringOf Of hoJResp "response.result.system.vat_number" To sVat_number


End_Procedure

Curl Command

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

Postman Collection Item JSON

{
  "name": "Get System ",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/json",
        "type": "text"
      }
    ],
    "url": {
      "raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/systems/systems/{{businessId}}",
      "protocol": "https",
      "host": [
        "api",
        "freshbooks",
        "com"
      ],
      "path": [
        "accounting",
        "account",
        "{{accountId}}",
        "systems",
        "systems",
        "{{businessId}}"
      ]
    },
    "description": "The value of `<id>` here is only meaningful if a user has access to multiple systems. See the Identity Model for more information."
  },
  "response": [
    {
      "name": "Get System ",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "url": {
          "raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/systems/systems/{{businessId}}",
          "protocol": "https",
          "host": [
            "api",
            "freshbooks",
            "com"
          ],
          "path": [
            "accounting",
            "account",
            "{{accountId}}",
            "systems",
            "systems",
            "{{businessId}}"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "X-NewRelic-App-Data",
          "value": "PxQBWV5TCBABVlVSAwEOVlcTGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4DFVdfRgFPCkNFR0gXSEVHBwsQWEMbSxZdVRYeA0kJTwFZC1VXAgRZXlANAgRQUVYEHRpXSBNUVlBfBwAFAQlUDw8GVwFUG01XAF8RAWs="
        },
        {
          "key": "Access-Control-Allow-Origin",
          "value": "*"
        },
        {
          "key": "Expires",
          "value": "Tue, 24 Apr 2018 18:38:32 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:38:32 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            \"system\": {\n                \"accountid\": \"wkMd2g\",\n                \"active\": true,\n                \"auto_bill\": 5,\n                \"billing_status\": \"uptodate\",\n                \"bus_phone\": \"\",\n                \"business_type\": null,\n                \"business_uuid\": null,\n                \"city\": \"\",\n                \"code\": \"\",\n                \"country\": \"Canada\",\n                \"currency_code\": \"USD\",\n                \"date\": \"2019-04-18 09:14:53\",\n                \"discountid\": null,\n                \"dst\": true,\n                \"duration\": 12,\n                \"email\": \"api.freshbooks@gmail.com\",\n                \"fax\": \"\",\n                \"gst_amount\": {\n                    \"amount\": \"0.00\",\n                    \"code\": \"USD\"\n                },\n                \"heard_about_us_via\": null,\n                \"id\": 4236410,\n                \"info_email\": \"api.freshbooks@gmail.com\",\n                \"ip\": \"62.205.194.4\",\n                \"landing_url\": null,\n                \"masterlock_billing\": true,\n                \"migrated_to_smux_at\": null,\n                \"mob_phone\": \"\",\n                \"modern_system\": true,\n                \"name\": \"Postman Sandbox\",\n                \"num_clients\": null,\n                \"num_staff\": null,\n                \"payment_amount\": {\n                    \"amount\": \"0.00\",\n                    \"code\": \"USD\"\n                },\n                \"payment_frequency\": 1,\n                \"province\": \"\",\n                \"referralid\": \"multibiz\",\n                \"referring_url\": null,\n                \"salutation\": null,\n                \"size_limit\": null,\n                \"split_token\": null,\n                \"street\": \"\",\n                \"street2\": null,\n                \"systemid\": 4236410,\n                \"test_system\": false,\n                \"timezone\": \"UTC\",\n                \"timezoneid\": 14,\n                \"vat_name\": null,\n                \"vat_number\": null\n            }\n        }\n    }\n}"
    }
  ]
}