Use ChilkatAx-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 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 Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams If (Not(IsComObjectCreated(hoQueryParams))) Begin Send CreateComObject of hoQueryParams End Get ComUpdateString Of hoQueryParams "start_date" "2019-01-01" To iSuccess Get ComUpdateString Of hoQueryParams "end_date" "2019-12-31" To iSuccess Get ComUpdateString Of hoQueryParams "currency_code" "USD" To iSuccess Get ComUpdateInt Of hoQueryParams "clientids" 31006 To iSuccess Get ComUpdateString Of hoQueryParams "item_names" "Fanny Pack" To iSuccess Get ComUpdateString Of hoQueryParams "statusids" "paid" To iSuccess // Adds the "Authorization: Bearer <access_token>" header. Set ComAuthToken Of hoHttp To "<access_token>" Get Create (RefClass(cComChilkatHttpResponse)) To hoResp If (Not(IsComObjectCreated(hoResp))) Begin Send CreateComObject of hoResp End Get pvComObject of hoQueryParams to vQueryParams Get pvComObject of hoResp to vResp Get ComHttpParams Of hoHttp "GET" "https://api.freshbooks.com/accounting/account/wkMd2g/reports/accounting/item_sales" vQueryParams vResp To iSuccess If (iSuccess = 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." Procedure_Return End End_Procedure
curl -G -d "start_date=2019-01-01" -d "end_date=2019-12-31" -d "currency_code=USD" -d "clientids=31006" -d "item_names=Fanny%20Pack" -d "statusids=paid" -H "Authorization: Bearer <access_token>" https://api.freshbooks.com/accounting/account/wkMd2g/reports/accounting/item_sales
{
"name": "Item Sales",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "https://api.freshbooks.com/accounting/account/wkMd2g/reports/accounting/item_sales?start_date=2019-01-01&end_date=2019-12-31¤cy_code=USD&clientids=31006&item_names=Fanny Pack&statusids=paid",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"accounting",
"account",
"wkMd2g",
"reports",
"accounting",
"item_sales"
],
"query": [
{
"key": "start_date",
"value": "2019-01-01",
"description": "created during or after the given date i.e. `2019-01-01`"
},
{
"key": "end_date",
"value": "2019-12-31",
"description": "created during or before the given date i.e. `2019-12-31`"
},
{
"key": "currency_code",
"value": "USD"
},
{
"key": "clientids",
"value": "31006"
},
{
"key": "item_names",
"value": "Fanny Pack"
},
{
"key": "statusids",
"value": "paid"
}
]
},
"description": "See how much money you're making from each item to sell."
},
"response": [
{
"name": "Item Sales",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "https://api.freshbooks.com/accounting/account/wkMd2g/reports/accounting/item_sales?start_date=2019-01-01&end_date=2019-12-31¤cy_code=USD&clientids=31006&item_names=Fanny Pack&statusids=paid",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"accounting",
"account",
"wkMd2g",
"reports",
"accounting",
"item_sales"
],
"query": [
{
"key": "start_date",
"value": "2019-01-01",
"description": "created during or after the given date i.e. `2019-01-01`"
},
{
"key": "end_date",
"value": "2019-12-31",
"description": "created during or before the given date i.e. `2019-12-31`"
},
{
"key": "currency_code",
"value": "USD"
},
{
"key": "clientids",
"value": "31006"
},
{
"key": "item_names",
"value": "Fanny Pack"
},
{
"key": "statusids",
"value": "paid"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "nginx"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "X-NewRelic-App-Data",
"value": "PxQBWV5TCBABVlVSAwEOVlcTGhE1AwE2QgNWEVlbQFtcCxYnRA9QFg1ZWU4DFVdfRgFPCkNFR0gWVEZcEBIQWFEBWw1NVkBbXQJLBEEOQRYXFBtRSlMWAgBTU1UDAQJTUAkGCldRU1EcTwlOGgkMBVJTXVZUUQdbUQAEVF9BFFVRCBIHag=="
},
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "Expires",
"value": "Tue, 24 Apr 2018 18:30:47 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:30:47 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 \"item_sales\": {\n \"clientids\": [],\n \"company_name\": \"Postman Sandbox\",\n \"currency_code\": \"USD\",\n \"download_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NvdW50aWQiOiJ3a01kMmciLCJ1c2VyaWQiOjEsImNvbnRhY3RpZCI6LTEsImxldmVsIjozLCJ0eXBlIjoicmVwb3J0Iiwib2JqZWN0aWQiOiJpdGVtX3NhbGVzIiwicGFyYW1zIjp7InN0YXJ0X2RhdGUiOiIyMDE5LTAxLTAxIiwiZW5kX2RhdGUiOiIyMDE5LTEyLTMxIiwiY3VycmVuY3lfY29kZSI6IlVTRCIsImNsaWVudGlkcyI6bnVsbCwic3RhdHVzaWRzIjpbXSwiaXRlbV9uYW1lcyI6W119LCJpYXQiOjE1NTYxMzA2NDcsImV4cCI6MTU1ODcyMjY0N30.h4AnC-DagiYu5Qp-qdFfa7DD5lZVJmYbUEnWTbuKoQc\",\n \"end_date\": \"2019-12-31\",\n \"item_names\": [],\n \"items\": [\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"2800.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000005\",\n \"invoiceid\": 26398,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"2800.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"overdue\"\n },\n {\n \"amount\": {\n \"amount\": \"2800.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000008\",\n \"invoiceid\": 28006,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"2800.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n }\n ],\n \"name\": \"Acting Services\",\n \"total\": {\n \"amount\": \"5600.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"2\"\n },\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Beaufort\",\n \"invoice_number\": \"0000010\",\n \"invoiceid\": 29610,\n \"lname\": \"Michelin\",\n \"organization\": \"Witting, McDermott and Gutmann\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n },\n {\n \"amount\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Tarra\",\n \"invoice_number\": \"0000011\",\n \"invoiceid\": 29616,\n \"lname\": \"Arblaster\",\n \"organization\": \"Hermann-Jast\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n },\n {\n \"amount\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000012\",\n \"invoiceid\": 29618,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"overdue\"\n },\n {\n \"amount\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000013\",\n \"invoiceid\": 34420,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"paid\"\n }\n ],\n \"name\": \"Belay Device\",\n \"total\": {\n \"amount\": \"400.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"4\"\n },\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000005\",\n \"invoiceid\": 26398,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"overdue\"\n }\n ],\n \"name\": \"Celebration\",\n \"total\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"1\"\n },\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000008\",\n \"invoiceid\": 28006,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n },\n {\n \"amount\": {\n \"amount\": \"80.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Beaufort\",\n \"invoice_number\": \"0000010\",\n \"invoiceid\": 29610,\n \"lname\": \"Michelin\",\n \"organization\": \"Witting, McDermott and Gutmann\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"80.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n },\n {\n \"amount\": {\n \"amount\": \"80.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Tarra\",\n \"invoice_number\": \"0000011\",\n \"invoiceid\": 29616,\n \"lname\": \"Arblaster\",\n \"organization\": \"Hermann-Jast\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"80.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n },\n {\n \"amount\": {\n \"amount\": \"80.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000012\",\n \"invoiceid\": 29618,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"80.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"overdue\"\n },\n {\n \"amount\": {\n \"amount\": \"80.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000013\",\n \"invoiceid\": 34420,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"80.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"paid\"\n }\n ],\n \"name\": \"Climbing Helmet\",\n \"total\": {\n \"amount\": \"820.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"5\"\n },\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-18\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000001\",\n \"invoiceid\": 24042,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"sent\"\n }\n ],\n \"name\": \"Computer Hardware\",\n \"total\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"1\"\n },\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-18\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000001\",\n \"invoiceid\": 24042,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"sent\"\n }\n ],\n \"name\": \"Computer Hardware 1\",\n \"total\": {\n \"amount\": \"500.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"1\"\n },\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"50.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-19\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Myrta\",\n \"invoice_number\": \"0000003\",\n \"invoiceid\": 26250,\n \"lname\": \"Westhofer\",\n \"organization\": \"Prosacco Group\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"50.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"paid\"\n },\n {\n \"amount\": {\n \"amount\": \"50.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Myrta\",\n \"invoice_number\": \"0000007\",\n \"invoiceid\": 28002,\n \"lname\": \"Westhofer\",\n \"organization\": \"Prosacco Group\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"50.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n }\n ],\n \"name\": \"Fanny Pack\",\n \"total\": {\n \"amount\": \"100.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"2\"\n },\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"5000.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000002\",\n \"invoiceid\": 24068,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"5000.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"paid\"\n },\n {\n \"amount\": {\n \"amount\": \"4100.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000004\",\n \"invoiceid\": 26384,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"4100.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n }\n ],\n \"name\": \"Paperwork\",\n \"total\": {\n \"amount\": \"9100.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"2\"\n },\n {\n \"invoices\": [\n {\n \"amount\": {\n \"amount\": \"3000.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000002\",\n \"invoiceid\": 24068,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"3000.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"paid\"\n },\n {\n \"amount\": {\n \"amount\": \"2800.00\",\n \"code\": \"USD\"\n },\n \"create_date\": \"2019-04-20\",\n \"discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"fname\": \"Nicolas\",\n \"invoice_number\": \"0000004\",\n \"invoiceid\": 26384,\n \"lname\": \"one\",\n \"organization\": \"first company\",\n \"qty\": \"1\",\n \"unit_cost\": {\n \"amount\": \"2800.00\",\n \"code\": \"USD\"\n },\n \"v3_status\": \"draft\"\n }\n ],\n \"name\": \"TV Ads\",\n \"total\": {\n \"amount\": \"5800.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"2\"\n }\n ],\n \"start_date\": \"2019-01-01\",\n \"statusids\": [],\n \"total\": {\n \"amount\": \"23320.00\",\n \"code\": \"USD\"\n },\n \"total_discount\": {\n \"amount\": \"0.00\",\n \"code\": \"USD\"\n },\n \"total_qty\": \"20\"\n }\n }\n }\n}"
}
]
}