Chilkat Online Tools

DataFlex / Belvo API Docs / Detail

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sId
    String sValue
    String sInstitutionValue
    String sCollected_atValue
    String sCategoryValue
    String sTypeValue
    String sNameValue
    String sNumberValue
    String sBalanceValue
    String sCurrencyValue
    String sBank_product_idValue
    String sInternal_identificationValue
    String sPublic_identification_nameValue
    String sPublic_identification_valueValue
    String sLast_accessed_atValue
    String sCredit_dataValue
    String sLoan_dataValue
    String sFunds_dataValue
    String sGig_payment_dataValue
    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

    Set ComBasicAuth Of hoHttp To True
    Set ComLogin Of hoHttp To "{{secretId}}"
    Set ComPassword Of hoHttp To "{{secretPassword}}"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://domain.com/api/accounts/:id/" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    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 ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

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

    // {
    //   "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>"
    //   }
    // }

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

    Get ComStringOf Of hoJResp "id" To sId
    Get ComStringOf Of hoJResp "link.value" To sValue
    Get ComStringOf Of hoJResp "institution.value" To sInstitutionValue
    Get ComStringOf Of hoJResp "collected_at.value" To sCollected_atValue
    Get ComStringOf Of hoJResp "category.value" To sCategoryValue
    Get ComStringOf Of hoJResp "type.value" To sTypeValue
    Get ComStringOf Of hoJResp "name.value" To sNameValue
    Get ComStringOf Of hoJResp "number.value" To sNumberValue
    Get ComStringOf Of hoJResp "balance.value" To sBalanceValue
    Get ComStringOf Of hoJResp "currency.value" To sCurrencyValue
    Get ComStringOf Of hoJResp "bank_product_id.value" To sBank_product_idValue
    Get ComStringOf Of hoJResp "internal_identification.value" To sInternal_identificationValue
    Get ComStringOf Of hoJResp "public_identification_name.value" To sPublic_identification_nameValue
    Get ComStringOf Of hoJResp "public_identification_value.value" To sPublic_identification_valueValue
    Get ComStringOf Of hoJResp "last_accessed_at.value" To sLast_accessed_atValue
    Get ComStringOf Of hoJResp "credit_data.value" To sCredit_dataValue
    Get ComStringOf Of hoJResp "loan_data.value" To sLoan_dataValue
    Get ComStringOf Of hoJResp "funds_data.value" To sFunds_dataValue
    Get ComStringOf Of hoJResp "gig_payment_data.value" To sGig_payment_dataValue


End_Procedure

Curl Command

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

Postman Collection Item JSON

{
  "name": "Detail",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/accounts/:id/",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "accounts",
        ":id",
        ""
      ],
      "variable": [
        {
          "key": "id",
          "value": "consequa",
          "description": "(Required) The `account.id` you want to get detailed information about."
        }
      ]
    },
    "description": "Get the details of a specific account."
  },
  "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/accounts/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "accounts",
            ":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\"link\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"institution\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"collected_at\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"category\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"type\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"name\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"number\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"balance\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"currency\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"bank_product_id\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"internal_identification\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"public_identification_name\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"public_identification_value\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"last_accessed_at\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"credit_data\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"loan_data\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"funds_data\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t},\n\t\"gig_payment_data\": {\n\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\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/accounts/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "accounts",
            ":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/accounts/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "accounts",
            ":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]"
    }
  ]
}