Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) Rabobank GET /v3/accounts

Demonstrates a call to a Rabobank API. Specifically this makes a call to the "Accounts AIS sb" API to deliver all the consented payments accounts for a specific Rabobank customer.

(This includes source code to for signing requests for PSD2 APIs)

For more information, see https://developer-sandbox.rabobank.nl/reference/accounts-ais-sb/3-0-8

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Handle hoJsonToken
    Handle hoSbTppCert
    Handle hoCrypt
    String sXRequestId
    Handle hoDt
    String sDateHdrVal
    String sPayload
    String sPayloadDigest
    Handle hoSbDigestHdrVal
    Handle hoSbStringToSign
    Handle hoSbPrivKey
    Variant vPrivKey
    Handle hoPrivKey
    Handle hoRsa
    String sB64Signature
    Handle hoCert
    Handle hoSbSigHdrVal
    Variant vTlsCert
    Handle hoTlsCert
    Variant vBdPrivKey
    Handle hoBdPrivKey
    Variant vTlsPrivKey
    Handle hoTlsPrivKey
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sV_linksAccount
    String sV_linksBalances
    String sV_linksTransactions
    String sCurrency
    String sIban
    String sName
    String sResourceId
    String sStatus
    Integer i
    Integer iCount_i
    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

    // Implements the following CURL command:

    // curl --request GET \
    //   --url https://api-sandbox.rabobank.nl/openapi/sandbox/payments/account-information/ais/v3/accounts \
    //   --header 'accept: application/json' \
    //   --header 'authorization: Bearer REPLACE_BEARER_TOKEN' \
    //   --header 'date: REPLACE_THIS_VALUE' \
    //   --header 'digest: REPLACE_THIS_VALUE' \
    //   --header 'psu-ip-address: OPTIONAL' \
    //   --header 'signature: REPLACE_THIS_VALUE' \
    //   --header 'tpp-signature-certificate: MIIDkDCCAnigA ... cwE6gUl0rMA==' \
    //   --header 'x-ibm-client-id: Client ID' \
    //   --header 'x-request-id: REPLACE_THIS_VALUE'

    // Load the previously fetched OAuth2 access token.
    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken
    If (Not(IsComObjectCreated(hoJsonToken))) Begin
        Send CreateComObject of hoJsonToken
    End
    Get ComLoadFile Of hoJsonToken "qa_data/tokens/rabobank.json" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoJsonToken To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // This adds the "authorization: Bearer REPLACE_BEARER_TOKEN" header.
    Get ComStringOf Of hoJsonToken "access_token" To sTemp1
    Set ComAuthToken Of hoHttp To sTemp1

    // This is the TTP Signature certificate: The certificate used for signing the request.
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbTppCert
    If (Not(IsComObjectCreated(hoSbTppCert))) Begin
        Send CreateComObject of hoSbTppCert
    End
    Get ComAppend Of hoSbTppCert "MIIDkDCCAnigAwIBAgIEWs3AJDANBgkqhkiG9w0BAQsFADCBiTELMAkGA1UEBhMC" To iSuccess
    Get ComAppend Of hoSbTppCert "TkwxEDAOBgNVBAgMB1V0cmVjaHQxEDAOBgNVBAcMB1V0cmVjaHQxETAPBgNVBAoM" To iSuccess
    Get ComAppend Of hoSbTppCert "CFJhYm9iYW5rMRwwGgYDVQQLDBNPbmxpbmUgVHJhbnNhY3Rpb25zMSUwIwYDVQQD" To iSuccess
    Get ComAppend Of hoSbTppCert "DBxQU0QyIEFQSSBQSSBTZXJ2aWNlcyBTYW5kYm94MB4XDTE4MDQxMTA3NTgyOFoX" To iSuccess
    Get ComAppend Of hoSbTppCert "DTIzMDQxMTA3NTgyOFowgYkxCzAJBgNVBAYTAk5MMRAwDgYDVQQIDAdVdHJlY2h0" To iSuccess
    Get ComAppend Of hoSbTppCert "MRAwDgYDVQQHDAdVdHJlY2h0MREwDwYDVQQKDAhSYWJvYmFuazEcMBoGA1UECwwT" To iSuccess
    Get ComAppend Of hoSbTppCert "T25saW5lIFRyYW5zYWN0aW9uczElMCMGA1UEAwwcUFNEMiBBUEkgUEkgU2Vydmlj" To iSuccess
    Get ComAppend Of hoSbTppCert "ZXMgU2FuZGJveDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANoAjqGW" To iSuccess
    Get ComAppend Of hoSbTppCert "UgCIm2F+0sBSEwLal+T3u+uldLikpxHCB8iL1GD7FrRjcA+MVsxhvHly7vRsHK+t" To iSuccess
    Get ComAppend Of hoSbTppCert "QyMSaeK782RHpY33qxPLc8LmoQLb2EuiQxXj9POYkYBQ74qkrZnvKVlR3WoyQWeD" To iSuccess
    Get ComAppend Of hoSbTppCert "OXnSY2wbNFfkP8ET4ElwyuIIEriwYhab0OIrnnrO8X82/SPZxHwEd3aQjQ6uhiw8" To iSuccess
    Get ComAppend Of hoSbTppCert "paDspJbS5WjEfuwY16KVVUYlhbtAwGjvc6aK0NBm+LH9fMLpAE6gfGZNy0gzMDor" To iSuccess
    Get ComAppend Of hoSbTppCert "VNbkQK1IoAGD8p9ZHdB0F3FwkILEjUiQW6nK+/fKDNJ0TBbpgZUpY8bR460qzxKd" To iSuccess
    Get ComAppend Of hoSbTppCert "eZ1yPDqX2Cjh6fkCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAYL4iD6noMJAt63kD" To iSuccess
    Get ComAppend Of hoSbTppCert "ED4RB2mII/lssvHhcxuDpOm3Ims9urubFWEpvV5TgIBAxy9PBinOdjhO1kGJJnYi" To iSuccess
    Get ComAppend Of hoSbTppCert "7F1jv1qnZwTV1JhYbvxv3+vk0jaiu7Ew7G3ASlzruXyMhN6t6jk9MpaWGl5Uw1T+" To iSuccess
    Get ComAppend Of hoSbTppCert "gNRUcWQRR44g3ahQRIS/UHkaV+vcpOa8j186/1X0ULHfbcVQk4LMmJeXqNs8sBAU" To iSuccess
    Get ComAppend Of hoSbTppCert "dKU/c6ssvj8jfJ4SfrurcBhY5UBTOdQOXTPY85aU3iFloerx7Oi9EHewxInOrU5X" To iSuccess
    Get ComAppend Of hoSbTppCert "zqqTz2AQPXezexVeAQxP27lzqCmYC7CFiam6QBr06VebkmnPLfs76n8CDc1cwE6g" To iSuccess
    Get ComAppend Of hoSbTppCert "Ul0rMA==" To iSuccess
    Get ComGetAsString Of hoSbTppCert To sTemp1
    Send ComSetRequestHeader To hoHttp "tpp-signature-certificate" sTemp1

    // ----------------------------------------------------------------
    // We're not going to add the psu-ip-address header in this example.

    // ----------------------------------------------------------------
    // X-Request-ID header...
    // Generate a UUID v4.
    Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt
    If (Not(IsComObjectCreated(hoCrypt))) Begin
        Send CreateComObject of hoCrypt
    End
    Get ComGenerateUuid Of hoCrypt To sXRequestId
    Send ComSetRequestHeader To hoHttp "x-request-id" sXRequestId

    // ----------------------------------------------------------------
    // Date header...
    Get Create (RefClass(cComCkDateTime)) To hoDt
    If (Not(IsComObjectCreated(hoDt))) Begin
        Send CreateComObject of hoDt
    End
    Get ComSetFromCurrentSystemTime Of hoDt To iSuccess
    Get ComGetAsRfc822 Of hoDt False To sDateHdrVal
    // The desire date/time format is the "RFC822" format.
    Send ComSetRequestHeader To hoHttp "Date" sDateHdrVal

    // ----------------------------------------------------------------
    // Digest header...
    Set ComHashAlgorithm Of hoCrypt To "SHA256"
    Set ComEncodingMode Of hoCrypt To "base64"
    // A GET request has no HTTP request body.  Therefore the payload is the empty string.
    Move "" To sPayload
    Get ComHashStringENC Of hoCrypt sPayload To sPayloadDigest
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbDigestHdrVal
    If (Not(IsComObjectCreated(hoSbDigestHdrVal))) Begin
        Send CreateComObject of hoSbDigestHdrVal
    End
    Get ComAppend Of hoSbDigestHdrVal "SHA-256=" To iSuccess
    Get ComAppend Of hoSbDigestHdrVal sPayloadDigest To iSuccess
    Get ComGetAsString Of hoSbDigestHdrVal To sTemp1
    Send ComSetRequestHeader To hoHttp "digest" sTemp1

    // ----------------------------------------------------------------
    // The HTTP request needs to be signed for PSD2 API's...
    // Create the signing string (to use in signing the HTTP request).
    // See https://developer.rabobank.nl/signing-requests-psd2-apis
    // 
    // For "account information" HTTP requests, we must use the following headers in the signing string.
    //    date
    //    digest
    //    x-request-id

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbStringToSign
    If (Not(IsComObjectCreated(hoSbStringToSign))) Begin
        Send CreateComObject of hoSbStringToSign
    End
    Get ComAppend Of hoSbStringToSign "date: " To iSuccess
    Get ComAppendLine Of hoSbStringToSign sDateHdrVal False To iSuccess
    Get ComAppend Of hoSbStringToSign "digest: " To iSuccess
    Get ComGetAsString Of hoSbDigestHdrVal To sTemp1
    Get ComAppendLine Of hoSbStringToSign sTemp1 False To iSuccess
    Get ComAppend Of hoSbStringToSign "x-request-id: " To iSuccess
    Get ComAppend Of hoSbStringToSign sXRequestId To iSuccess

    // ----------------------------------------------------------------
    // Sign with our private key...
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbPrivKey
    If (Not(IsComObjectCreated(hoSbPrivKey))) Begin
        Send CreateComObject of hoSbPrivKey
    End
    Get ComAppend Of hoSbPrivKey "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDaAI6hllIAiJth" To iSuccess
    Get ComAppend Of hoSbPrivKey "ftLAUhMC2pfk97vrpXS4pKcRwgfIi9Rg+xa0Y3APjFbMYbx5cu70bByvrUMjEmni" To iSuccess
    Get ComAppend Of hoSbPrivKey "u/NkR6WN96sTy3PC5qEC29hLokMV4/TzmJGAUO+KpK2Z7ylZUd1qMkFngzl50mNs" To iSuccess
    Get ComAppend Of hoSbPrivKey "GzRX5D/BE+BJcMriCBK4sGIWm9DiK556zvF/Nv0j2cR8BHd2kI0OroYsPKWg7KSW" To iSuccess
    Get ComAppend Of hoSbPrivKey "0uVoxH7sGNeilVVGJYW7QMBo73OmitDQZvix/XzC6QBOoHxmTctIMzA6K1TW5ECt" To iSuccess
    Get ComAppend Of hoSbPrivKey "SKABg/KfWR3QdBdxcJCCxI1IkFupyvv3ygzSdEwW6YGVKWPG0eOtKs8SnXmdcjw6" To iSuccess
    Get ComAppend Of hoSbPrivKey "l9go4en5AgMBAAECggEAB8nsTqalwGIhFw8mbXuhNUFlGuek/arYLD6pv28swwQH" To iSuccess
    Get ComAppend Of hoSbPrivKey "7v0ZlxFUcCHF+iBl0PsDwZTZQ4ePtgGS6ehoLkWHCzb1lEv5E1YVG5qKNE2UUwRl" To iSuccess
    Get ComAppend Of hoSbPrivKey "fIyPakO6AzyV/UF3uzq7C+/GuXGNTKZxKewg5yD/DCFvKoCOpxu9u36FyqP/hw0S" To iSuccess
    Get ComAppend Of hoSbPrivKey "ADVlmp35/zoPDPZzu1j4FiCo0pJ9LwJcHxeJHopNAKDw9k6I4z/grskdgupsGzK2" To iSuccess
    Get ComAppend Of hoSbPrivKey "BiGiQ/+wmmO68/6Xa6KWfpr1PQ6ODJHgzZsdGCVi6Ebaqlj6BbsYWxP6h3lrsGt+" To iSuccess
    Get ComAppend Of hoSbPrivKey "LmHBaN2jCD6cDp+lihqFgnm8hfdv0lmbPilp71EDfwKBgQD6U8PBzZtN8yXm5WuS" To iSuccess
    Get ComAppend Of hoSbPrivKey "NL+/8q5GjNmeTJBSo1gM6Y8vOT4QAE147LbVuVBDwyHPoSrNejePae6Q14PswjBy" To iSuccess
    Get ComAppend Of hoSbPrivKey "T7B8DZ0OeQyGa3trrFg/ib7Vv4ZMvJqX9+WzBrzZsxTg7oCKHzmCR4vIRItKHH3z" To iSuccess
    Get ComAppend Of hoSbPrivKey "Wnnhqlo8ic2AZ2O43cdJosbO1wKBgQDe8UODOLu0vnHohOKeUqF3w/ZOB2+83/js" To iSuccess
    Get ComAppend Of hoSbPrivKey "YyUbSkzsGvHIwTjObuMUFTQvdMZ6IkIyJdfnDZIbvlBSD8tzL5iKFTNCK2nL1i4G" To iSuccess
    Get ComAppend Of hoSbPrivKey "iFr0CYLaHAlhJ5GEbTrTMDoJeBPerZq83HPrSa/Wb0xO18QTWsoVQPFfPFbbcQyI" To iSuccess
    Get ComAppend Of hoSbPrivKey "9ryJ2iIDrwKBgQC6kuAefG46ZPVk6K2KZUJdgDUgZC52a75NuW0RAqszmUiGiJM1" To iSuccess
    Get ComAppend Of hoSbPrivKey "g8ip9tq6BqAWrprGV0c93shusBKlzf5p1LdHXqYmeVY6gbWVhPipMrNHgN5KJ3BZ" To iSuccess
    Get ComAppend Of hoSbPrivKey "v+w1yNnMsErpcxne2HL2hPjMJTpj3GSLkm2xIlTrNhIyl9ydlr7IRUhENQKBgQCv" To iSuccess
    Get ComAppend Of hoSbPrivKey "i6HxbXa/90WSJTCcIcxqla8X+dsOCf3jhJ3vQy4Wq5C+1wZ35fCAG8Ifq/+so9Uj" To iSuccess
    Get ComAppend Of hoSbPrivKey "z5CVqqXlmpF8TFuSs2OVNuRJsg14J4nOMwgLKIIUZAcurQ10DN5I9Kx+UEK1EFXL" To iSuccess
    Get ComAppend Of hoSbPrivKey "aHsORdNjMfgQDO2jn9WHrr9gkg6CdB2+qyoCEfS+mQKBgBW08lcy9V5RzRWb/v/j" To iSuccess
    Get ComAppend Of hoSbPrivKey "xsc7ovmgAhCJhDeV7dPbx4HbFeoQJlbA8g1thdcFlcatSGyNDbvNE1GPSd4NhkpR" To iSuccess
    Get ComAppend Of hoSbPrivKey "Y6Hfv53kdEzjVkEtU8lUdL7HNVJqX7bU7oZlfbYcwxWQ1Gg8C1oLIAyEt71slQtd" To iSuccess
    Get ComAppend Of hoSbPrivKey "RiNYBRZTQe2F0wxbXnuUqLAw" To iSuccess

    Get Create (RefClass(cComChilkatPrivateKey)) To hoPrivKey
    If (Not(IsComObjectCreated(hoPrivKey))) Begin
        Send CreateComObject of hoPrivKey
    End
    Get ComGetAsString Of hoSbPrivKey To sTemp1
    Get ComLoadPem Of hoPrivKey sTemp1 To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoPrivKey To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatRsa)) To hoRsa
    If (Not(IsComObjectCreated(hoRsa))) Begin
        Send CreateComObject of hoRsa
    End
    Get pvComObject of hoPrivKey to vPrivKey
    Get ComImportPrivateKeyObj Of hoRsa vPrivKey To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoRsa To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Set ComEncodingMode Of hoRsa To "base64"
    Get ComGetAsString Of hoSbStringToSign To sTemp1
    Get ComSignStringENC Of hoRsa sTemp1 "SHA256" To sB64Signature

    // ----------------------------------------------------------------
    // Add the "signature" header.
    // 
    // The signature header will look like this:
    // signature: keyId="1523433508",algorithm="rsa-sha512",headers="date digest x-request-id",signature="y5o7gKxmfA6AT6...blE1A9Q=="
    // 
    // The keyId is the serial number of the certificate as defined in 'TPP-Signing-Certificate' header, the format should be Integer not hex. 
    Get Create (RefClass(cComChilkatCert)) To hoCert
    If (Not(IsComObjectCreated(hoCert))) Begin
        Send CreateComObject of hoCert
    End
    Get ComGetAsString Of hoSbTppCert To sTemp1
    Get ComSetFromEncoded Of hoCert sTemp1 To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoCert To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbSigHdrVal
    If (Not(IsComObjectCreated(hoSbSigHdrVal))) Begin
        Send CreateComObject of hoSbSigHdrVal
    End
    Get ComAppend Of hoSbSigHdrVal 'keyId="' To iSuccess
    Get ComSerialDecimal Of hoCert To sTemp1
    Get ComAppend Of hoSbSigHdrVal sTemp1 To iSuccess
    Get ComAppend Of hoSbSigHdrVal '",' To iSuccess
    Get ComAppend Of hoSbSigHdrVal 'algorithm="rsa-sha256",' To iSuccess
    Get ComAppend Of hoSbSigHdrVal 'headers="date digest x-request-id",' To iSuccess
    Get ComAppend Of hoSbSigHdrVal 'signature="' To iSuccess
    Get ComAppend Of hoSbSigHdrVal sB64Signature To iSuccess
    Get ComAppend Of hoSbSigHdrVal '"' To iSuccess

    Get ComGetAsString Of hoSbSigHdrVal To sTemp1
    Send ComSetRequestHeader To hoHttp "signature" sTemp1

    // ----------------------------------------------------------------
    // Add remaining headers...

    Send ComSetRequestHeader To hoHttp "x-ibm-client-id" "YOUR_APP_CLIENT_ID"
    Send ComSetRequestHeader To hoHttp "accept" "application/json"

    // ----------------------------------------------------------------
    // Add our certificate and key for mutual TLS 
    // (provide a registered X509 client certificate during TLS handhake)

    Get Create (RefClass(cComChilkatCert)) To hoTlsCert
    If (Not(IsComObjectCreated(hoTlsCert))) Begin
        Send CreateComObject of hoTlsCert
    End
    Get ComLoadFromFile Of hoTlsCert "qa_data/certs_and_keys/ING/example_client_tls.cer" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoTlsCert To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatBinData)) To hoBdPrivKey
    If (Not(IsComObjectCreated(hoBdPrivKey))) Begin
        Send CreateComObject of hoBdPrivKey
    End
    Get ComLoadFile Of hoBdPrivKey "qa_data/certs_and_keys/ING/example_client_tls.key" To iSuccess
    If (iSuccess = False) Begin
        Showln "Failed to load example_client_tls.key"
        Procedure_Return
    End

    // The OAuth 2.0 client_id for these certificates is e77d776b-90af-4684-bebc-521e5b2614dd. 
    // Please note down this client_id since you will need it in the next steps to call the API.

    Get Create (RefClass(cComChilkatPrivateKey)) To hoTlsPrivKey
    If (Not(IsComObjectCreated(hoTlsPrivKey))) Begin
        Send CreateComObject of hoTlsPrivKey
    End
    Get pvComObject of hoBdPrivKey to vBdPrivKey
    Get ComLoadAnyFormat Of hoTlsPrivKey vBdPrivKey "" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoTlsPrivKey To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Associate the private key with the certificate.
    Get pvComObject of hoTlsPrivKey to vTlsPrivKey
    Get ComSetPrivateKey Of hoTlsCert vTlsPrivKey To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoTlsCert To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get pvComObject of hoTlsCert to vTlsCert
    Get ComSetSslClientCert Of hoHttp vTlsCert To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // ----------------------------------------------------------------
    // Finally, send the request...

    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://api-sandbox.rabobank.nl/openapi/sandbox/payments/account-information/ais/v3/accounts" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Get ComGetAsString Of hoSbResponseBody 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)

    // {
    //   "accounts": [
    //     {
    //       "_links": {
    //         "account": "/v3/accounts/dW9od2VIVUhGVypIZHVpaGRhdWR3OGRoY",
    //         "balances": "/v3/accounts/dW9od2VIVUhGVypIZHVpaGRhdWR3OGRoY/balances",
    //         "transactions": "/v3/accounts/dW9od2VIVUhGVypIZHVpaGRhdWR3OGRoY/transactions"
    //       },
    //       "currency": "EUR",
    //       "iban": "NL05RABO0812836782",
    //       "name": "Rosie Roy",
    //       "resourceId": "dW9od2VIVUhGVypIZHVpaGRhdWR3OGRoY",
    //       "status": "enabled"
    //     }
    //   ]
    // }

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

    Move 0 To i
    Get ComSizeOfArray Of hoJResp "accounts" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "accounts[i]._links.account" To sV_linksAccount
        Get ComStringOf Of hoJResp "accounts[i]._links.balances" To sV_linksBalances
        Get ComStringOf Of hoJResp "accounts[i]._links.transactions" To sV_linksTransactions
        Get ComStringOf Of hoJResp "accounts[i].currency" To sCurrency
        Get ComStringOf Of hoJResp "accounts[i].iban" To sIban
        Get ComStringOf Of hoJResp "accounts[i].name" To sName
        Get ComStringOf Of hoJResp "accounts[i].resourceId" To sResourceId
        Get ComStringOf Of hoJResp "accounts[i].status" To sStatus
        Move (i + 1) To i
    Loop



End_Procedure

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.