VB6 / New FreshBooks / List Items Filtered by SKU
Back to Collection Items
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New ChilkatHttp
Dim success As Long
Dim queryParams As New ChilkatJsonObject
success = queryParams.UpdateString("search[sku]","{{sku}}")
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
http.SetRequestHeader "Content-Type","application/json"
Dim resp As ChilkatHttpResponse
Set resp = http.QuickRequestParams("GET","https://api.freshbooks.com/accounting/account/{{accountId}}/items/items",queryParams)
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Debug.Print resp.StatusCode
Debug.Print resp.BodyStr
Curl Command
curl -G -d "search[sku]=%7B%7Bsku%7D%7D"
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
https://api.freshbooks.com/accounting/account/{{accountId}}/items/items
Postman Collection Item JSON
{
"name": "List Items Filtered by SKU",
"event": [
{
"listen": "test",
"script": {
"exec": [
"var jsonData = JSON.parse(responseBody);",
"pm.environment.set(\"itemId\", jsonData.response.result.items[5].id);",
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://api.freshbooks.com/accounting/account/{{accountId}}/items/items?search%5Bsku%5D={{sku}}",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"accounting",
"account",
"{{accountId}}",
"items",
"items"
],
"query": [
{
"key": "search%5Bsku%5D",
"value": "{{sku}}"
}
]
}
},
"response": [
]
}