Chilkat Online Tools

Xojo / Belvo API Docs / Detail

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 Chilkat.Http
Dim success As Boolean

http.BasicAuth = True
http.Login = "{{secretId}}"
http.Password = "{{secretPassword}}"

Dim sbResponseBody As New Chilkat.StringBuilder
success = http.QuickGetSb("https://domain.com/api/transactions/:id/",sbResponseBody)
If (success = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

Dim jResp As New Chilkat.JsonObject
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = False

System.DebugLog("Response Body:")
System.DebugLog(jResp.Emit())

Dim respStatusCode As Int32
respStatusCode = http.LastStatus
System.DebugLog("Response Status Code = " + Str(respStatusCode))
If (respStatusCode >= 400) Then
    System.DebugLog("Response Header:")
    System.DebugLog(http.LastHeader)
    System.DebugLog("Failed.")
    Return
End If

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

// {
//   "id": "<uuid>",
//   "account": {
//     "id": "<uuid>",
//     "link": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "institution": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "collected_at": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "category": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "type": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "name": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "number": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "balance": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "currency": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "bank_product_id": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "internal_identification": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "public_identification_name": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "public_identification_value": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "last_accessed_at": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "credit_data": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "loan_data": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "funds_data": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     },
//     "gig_payment_data": {
//       "value": "<Error: Too many levels of nesting to fake this schema>"
//     }
//   },
//   "collected_at": "<date>",
//   "value_date": "<string>",
//   "accounting_date": "<date>",
//   "amount": "<number>",
//   "balance": "<number>",
//   "currency": "<string>",
//   "description": "<string>",
//   "observations": "<string>",
//   "category": "<string>",
//   "reference": "<string>",
//   "type": "eiusmod veniam ea sint",
//   "status": "est nostrud",
//   "gig_data": {
//     "pickup_at": "<dateTime>",
//     "dropoff_at": "<dateTime>",
//     "request_at": "<dateTime>",
//     "pickup_address": "<string>",
//     "dropoff_address": "<string>",
//     "pickup_latitude": "<number>",
//     "pickup_longitude": "<number>",
//     "dropoff_latitude": "<number>",
//     "dropoff_longitude": "<number>",
//     "distance": "<number>",
//     "payment_method": "<string>",
//     "vehicle_type": "<string>",
//     "merchant_type": "<string>",
//     "breakdown": [
//       {
//         "value": "<Error: Too many levels of nesting to fake this schema>"
//       },
//       {
//         "value": "<Error: Too many levels of nesting to fake this schema>"
//       }
//     ],
//     "collected_at": "<dateTime>"
//   },
//   "credit_card_data": {
//     "bill_name": "<string>"
//   }
// }

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

Dim value As String

Dim id As String
id = jResp.StringOf("id")
Dim Id As String
Id = jResp.StringOf("account.id")
Dim Value As String
Value = jResp.StringOf("account.link.value")
Dim InstitutionValue As String
InstitutionValue = jResp.StringOf("account.institution.value")
Dim Collected_atValue As String
Collected_atValue = jResp.StringOf("account.collected_at.value")
Dim CategoryValue As String
CategoryValue = jResp.StringOf("account.category.value")
Dim TypeValue As String
TypeValue = jResp.StringOf("account.type.value")
Dim NameValue As String
NameValue = jResp.StringOf("account.name.value")
Dim NumberValue As String
NumberValue = jResp.StringOf("account.number.value")
Dim BalanceValue As String
BalanceValue = jResp.StringOf("account.balance.value")
Dim CurrencyValue As String
CurrencyValue = jResp.StringOf("account.currency.value")
Dim Bank_product_idValue As String
Bank_product_idValue = jResp.StringOf("account.bank_product_id.value")
Dim Internal_identificationValue As String
Internal_identificationValue = jResp.StringOf("account.internal_identification.value")
Dim Public_identification_nameValue As String
Public_identification_nameValue = jResp.StringOf("account.public_identification_name.value")
Dim Public_identification_valueValue As String
Public_identification_valueValue = jResp.StringOf("account.public_identification_value.value")
Dim Last_accessed_atValue As String
Last_accessed_atValue = jResp.StringOf("account.last_accessed_at.value")
Dim Credit_dataValue As String
Credit_dataValue = jResp.StringOf("account.credit_data.value")
Dim Loan_dataValue As String
Loan_dataValue = jResp.StringOf("account.loan_data.value")
Dim Funds_dataValue As String
Funds_dataValue = jResp.StringOf("account.funds_data.value")
Dim Gig_payment_dataValue As String
Gig_payment_dataValue = jResp.StringOf("account.gig_payment_data.value")
Dim collected_at As String
collected_at = jResp.StringOf("collected_at")
Dim value_date As String
value_date = jResp.StringOf("value_date")
Dim accounting_date As String
accounting_date = jResp.StringOf("accounting_date")
Dim amount As String
amount = jResp.StringOf("amount")
Dim balance As String
balance = jResp.StringOf("balance")
Dim v_currency As String
v_currency = jResp.StringOf("currency")
Dim description As String
description = jResp.StringOf("description")
Dim observations As String
observations = jResp.StringOf("observations")
Dim category As String
category = jResp.StringOf("category")
Dim reference As String
reference = jResp.StringOf("reference")
Dim v_type As String
v_type = jResp.StringOf("type")
Dim status As String
status = jResp.StringOf("status")
Dim Pickup_at As String
Pickup_at = jResp.StringOf("gig_data.pickup_at")
Dim Dropoff_at As String
Dropoff_at = jResp.StringOf("gig_data.dropoff_at")
Dim Request_at As String
Request_at = jResp.StringOf("gig_data.request_at")
Dim Pickup_address As String
Pickup_address = jResp.StringOf("gig_data.pickup_address")
Dim Dropoff_address As String
Dropoff_address = jResp.StringOf("gig_data.dropoff_address")
Dim Pickup_latitude As String
Pickup_latitude = jResp.StringOf("gig_data.pickup_latitude")
Dim Pickup_longitude As String
Pickup_longitude = jResp.StringOf("gig_data.pickup_longitude")
Dim Dropoff_latitude As String
Dropoff_latitude = jResp.StringOf("gig_data.dropoff_latitude")
Dim Dropoff_longitude As String
Dropoff_longitude = jResp.StringOf("gig_data.dropoff_longitude")
Dim Distance As String
Distance = jResp.StringOf("gig_data.distance")
Dim Payment_method As String
Payment_method = jResp.StringOf("gig_data.payment_method")
Dim Vehicle_type As String
Vehicle_type = jResp.StringOf("gig_data.vehicle_type")
Dim Merchant_type As String
Merchant_type = jResp.StringOf("gig_data.merchant_type")
Dim Collected_at As String
Collected_at = jResp.StringOf("gig_data.collected_at")
Dim Bill_name As String
Bill_name = jResp.StringOf("credit_card_data.bill_name")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = jResp.SizeOfArray("gig_data.breakdown")
While i < count_i
    jResp.I = i
    value = jResp.StringOf("gig_data.breakdown[i].value")
    i = i + 1
Wend

Curl Command

curl -X GET
	-u '{{secretId}}:{{secretPassword}}'
https://domain.com/api/transactions/:id/

Postman Collection Item JSON

{
  "name": "Detail",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/transactions/:id/",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "transactions",
        ":id",
        ""
      ],
      "variable": [
        {
          "key": "id",
          "value": "consequa",
          "description": "(Required) The `transaction.id` you want to get detailed information about."
        }
      ]
    },
    "description": "Get the details of a specific transaction."
  },
  "response": [
    {
      "name": "Ok",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/transactions/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "transactions",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n\t\"id\": \"<uuid>\",\n\t\"account\": {\n\t\t\"id\": \"<uuid>\",\n\t\t\"link\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"institution\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"collected_at\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"category\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"type\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"name\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"number\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"balance\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"currency\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"bank_product_id\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"internal_identification\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"public_identification_name\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"public_identification_value\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"last_accessed_at\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"credit_data\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"loan_data\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"funds_data\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t\"gig_payment_data\": {\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t}\n\t},\n\t\"collected_at\": \"<date>\",\n\t\"value_date\": \"<string>\",\n\t\"accounting_date\": \"<date>\",\n\t\"amount\": \"<number>\",\n\t\"balance\": \"<number>\",\n\t\"currency\": \"<string>\",\n\t\"description\": \"<string>\",\n\t\"observations\": \"<string>\",\n\t\"category\": \"<string>\",\n\t\"reference\": \"<string>\",\n\t\"type\": \"eiusmod veniam ea sint\",\n\t\"status\": \"est nostrud\",\n\t\"gig_data\": {\n\t\t\"pickup_at\": \"<dateTime>\",\n\t\t\"dropoff_at\": \"<dateTime>\",\n\t\t\"request_at\": \"<dateTime>\",\n\t\t\"pickup_address\": \"<string>\",\n\t\t\"dropoff_address\": \"<string>\",\n\t\t\"pickup_latitude\": \"<number>\",\n\t\t\"pickup_longitude\": \"<number>\",\n\t\t\"dropoff_latitude\": \"<number>\",\n\t\t\"dropoff_longitude\": \"<number>\",\n\t\t\"distance\": \"<number>\",\n\t\t\"payment_method\": \"<string>\",\n\t\t\"vehicle_type\": \"<string>\",\n\t\t\"merchant_type\": \"<string>\",\n\t\t\"breakdown\": [\n\t\t\t{\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t\t}\n\t\t],\n\t\t\"collected_at\": \"<dateTime>\"\n\t},\n\t\"credit_card_data\": {\n\t\t\"bill_name\": \"<string>\"\n\t}\n}"
    },
    {
      "name": "Unauthorized",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/transactions/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "transactions",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "[\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t},\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t}\n]"
    },
    {
      "name": "Too Many Sessions",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: basic",
            "key": "Authorization",
            "value": "Basic <credentials>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/transactions/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "transactions",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "[\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t},\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t}\n]"
    }
  ]
}