Chilkat Online Tools

Foxpro / Belvo API Docs / Detail

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcValue
LOCAL lcId
LOCAL lcId
LOCAL lcValue
LOCAL lcInstitutionValue
LOCAL lcCollected_atValue
LOCAL lcCategoryValue
LOCAL lcTypeValue
LOCAL lcNameValue
LOCAL lcNumberValue
LOCAL lcBalanceValue
LOCAL lcCurrencyValue
LOCAL lcBank_product_idValue
LOCAL lcInternal_identificationValue
LOCAL lcPublic_identification_nameValue
LOCAL lcPublic_identification_valueValue
LOCAL lcLast_accessed_atValue
LOCAL lcCredit_dataValue
LOCAL lcLoan_dataValue
LOCAL lcFunds_dataValue
LOCAL lcGig_payment_dataValue
LOCAL lcCollected_at
LOCAL lcValue_date
LOCAL lcAccounting_date
LOCAL lcAmount
LOCAL lcBalance
LOCAL lcV_currency
LOCAL lcDescription
LOCAL lcObservations
LOCAL lcCategory
LOCAL lcReference
LOCAL lcV_type
LOCAL lcStatus
LOCAL lcPickup_at
LOCAL lcDropoff_at
LOCAL lcRequest_at
LOCAL lcPickup_address
LOCAL lcDropoff_address
LOCAL lcPickup_latitude
LOCAL lcPickup_longitude
LOCAL lcDropoff_latitude
LOCAL lcDropoff_longitude
LOCAL lcDistance
LOCAL lcPayment_method
LOCAL lcVehicle_type
LOCAL lcMerchant_type
LOCAL lcCollected_at
LOCAL lcBill_name
LOCAL i
LOCAL lnCount_i

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

loHttp.BasicAuth = 1
loHttp.Login = "{{secretId}}"
loHttp.Password = "{{secretPassword}}"

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://domain.com/api/transactions/:id/",loSbResponseBody)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loSbResponseBody
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
    ? "Response Header:"
    ? loHttp.LastHeader
    ? "Failed."
    RELEASE loHttp
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

* 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

lcId = loJResp.StringOf("id")
lcId = loJResp.StringOf("account.id")
lcValue = loJResp.StringOf("account.link.value")
lcInstitutionValue = loJResp.StringOf("account.institution.value")
lcCollected_atValue = loJResp.StringOf("account.collected_at.value")
lcCategoryValue = loJResp.StringOf("account.category.value")
lcTypeValue = loJResp.StringOf("account.type.value")
lcNameValue = loJResp.StringOf("account.name.value")
lcNumberValue = loJResp.StringOf("account.number.value")
lcBalanceValue = loJResp.StringOf("account.balance.value")
lcCurrencyValue = loJResp.StringOf("account.currency.value")
lcBank_product_idValue = loJResp.StringOf("account.bank_product_id.value")
lcInternal_identificationValue = loJResp.StringOf("account.internal_identification.value")
lcPublic_identification_nameValue = loJResp.StringOf("account.public_identification_name.value")
lcPublic_identification_valueValue = loJResp.StringOf("account.public_identification_value.value")
lcLast_accessed_atValue = loJResp.StringOf("account.last_accessed_at.value")
lcCredit_dataValue = loJResp.StringOf("account.credit_data.value")
lcLoan_dataValue = loJResp.StringOf("account.loan_data.value")
lcFunds_dataValue = loJResp.StringOf("account.funds_data.value")
lcGig_payment_dataValue = loJResp.StringOf("account.gig_payment_data.value")
lcCollected_at = loJResp.StringOf("collected_at")
lcValue_date = loJResp.StringOf("value_date")
lcAccounting_date = loJResp.StringOf("accounting_date")
lcAmount = loJResp.StringOf("amount")
lcBalance = loJResp.StringOf("balance")
lcV_currency = loJResp.StringOf("currency")
lcDescription = loJResp.StringOf("description")
lcObservations = loJResp.StringOf("observations")
lcCategory = loJResp.StringOf("category")
lcReference = loJResp.StringOf("reference")
lcV_type = loJResp.StringOf("type")
lcStatus = loJResp.StringOf("status")
lcPickup_at = loJResp.StringOf("gig_data.pickup_at")
lcDropoff_at = loJResp.StringOf("gig_data.dropoff_at")
lcRequest_at = loJResp.StringOf("gig_data.request_at")
lcPickup_address = loJResp.StringOf("gig_data.pickup_address")
lcDropoff_address = loJResp.StringOf("gig_data.dropoff_address")
lcPickup_latitude = loJResp.StringOf("gig_data.pickup_latitude")
lcPickup_longitude = loJResp.StringOf("gig_data.pickup_longitude")
lcDropoff_latitude = loJResp.StringOf("gig_data.dropoff_latitude")
lcDropoff_longitude = loJResp.StringOf("gig_data.dropoff_longitude")
lcDistance = loJResp.StringOf("gig_data.distance")
lcPayment_method = loJResp.StringOf("gig_data.payment_method")
lcVehicle_type = loJResp.StringOf("gig_data.vehicle_type")
lcMerchant_type = loJResp.StringOf("gig_data.merchant_type")
lcCollected_at = loJResp.StringOf("gig_data.collected_at")
lcBill_name = loJResp.StringOf("credit_card_data.bill_name")
i = 0
lnCount_i = loJResp.SizeOfArray("gig_data.breakdown")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcValue = loJResp.StringOf("gig_data.breakdown[i].value")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp

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]"
    }
  ]
}