Chilkat Online Tools

delphiDll / Belvo API Docs / Detail

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
sbResponseBody: HCkStringBuilder;
jResp: HCkJsonObject;
respStatusCode: Integer;
value: PWideChar;
id: PWideChar;
Id: PWideChar;
Value: PWideChar;
InstitutionValue: PWideChar;
Collected_atValue: PWideChar;
CategoryValue: PWideChar;
TypeValue: PWideChar;
NameValue: PWideChar;
NumberValue: PWideChar;
BalanceValue: PWideChar;
CurrencyValue: PWideChar;
Bank_product_idValue: PWideChar;
Internal_identificationValue: PWideChar;
Public_identification_nameValue: PWideChar;
Public_identification_valueValue: PWideChar;
Last_accessed_atValue: PWideChar;
Credit_dataValue: PWideChar;
Loan_dataValue: PWideChar;
Funds_dataValue: PWideChar;
Gig_payment_dataValue: PWideChar;
collected_at: PWideChar;
value_date: PWideChar;
accounting_date: PWideChar;
amount: PWideChar;
balance: PWideChar;
v_currency: PWideChar;
description: PWideChar;
observations: PWideChar;
category: PWideChar;
reference: PWideChar;
v_type: PWideChar;
status: PWideChar;
Pickup_at: PWideChar;
Dropoff_at: PWideChar;
Request_at: PWideChar;
Pickup_address: PWideChar;
Dropoff_address: PWideChar;
Pickup_latitude: PWideChar;
Pickup_longitude: PWideChar;
Dropoff_latitude: PWideChar;
Dropoff_longitude: PWideChar;
Distance: PWideChar;
Payment_method: PWideChar;
Vehicle_type: PWideChar;
Merchant_type: PWideChar;
Collected_at: PWideChar;
Bill_name: PWideChar;
i: Integer;
count_i: Integer;

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

http := CkHttp_Create();

CkHttp_putBasicAuth(http,True);
CkHttp_putLogin(http,'{{secretId}}');
CkHttp_putPassword(http,'{{secretPassword}}');

sbResponseBody := CkStringBuilder_Create();
success := CkHttp_QuickGetSb(http,'https://domain.com/api/transactions/:id/',sbResponseBody);
if (success = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,False);

Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkJsonObject__emit(jResp));

respStatusCode := CkHttp_getLastStatus(http);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode >= 400) then
  begin
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(CkHttp__lastHeader(http));
    Memo1.Lines.Add('Failed.');
    Exit;
  end;

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

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

CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);

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