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

Visual FoxPro 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

 

 

 

(Visual FoxPro) 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

LOCAL loHttp
LOCAL lnSuccess
LOCAL loJsonToken
LOCAL loSbTppCert
LOCAL loCrypt
LOCAL lcXRequestId
LOCAL loDt
LOCAL lcDateHdrVal
LOCAL lcPayload
LOCAL lcPayloadDigest
LOCAL loSbDigestHdrVal
LOCAL loSbStringToSign
LOCAL loSbPrivKey
LOCAL loPrivKey
LOCAL loRsa
LOCAL lcB64Signature
LOCAL loCert
LOCAL loSbSigHdrVal
LOCAL loTlsCert
LOCAL loBdPrivKey
LOCAL loTlsPrivKey
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcV_linksAccount
LOCAL lcV_linksBalances
LOCAL lcV_linksTransactions
LOCAL lcCurrency
LOCAL lcIban
LOCAL lcName
LOCAL lcResourceId
LOCAL lcStatus
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')

* 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.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJsonToken = CreateObject('Chilkat.JsonObject')
lnSuccess = loJsonToken.LoadFile("qa_data/tokens/rabobank.json")
IF (lnSuccess = 0) THEN
    ? loJsonToken.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    CANCEL
ENDIF

* This adds the "authorization: Bearer REPLACE_BEARER_TOKEN" header.
loHttp.AuthToken = loJsonToken.StringOf("access_token")

* This is the TTP Signature certificate: The certificate used for signing the request.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbTppCert = CreateObject('Chilkat.StringBuilder')
loSbTppCert.Append("MIIDkDCCAnigAwIBAgIEWs3AJDANBgkqhkiG9w0BAQsFADCBiTELMAkGA1UEBhMC")
loSbTppCert.Append("TkwxEDAOBgNVBAgMB1V0cmVjaHQxEDAOBgNVBAcMB1V0cmVjaHQxETAPBgNVBAoM")
loSbTppCert.Append("CFJhYm9iYW5rMRwwGgYDVQQLDBNPbmxpbmUgVHJhbnNhY3Rpb25zMSUwIwYDVQQD")
loSbTppCert.Append("DBxQU0QyIEFQSSBQSSBTZXJ2aWNlcyBTYW5kYm94MB4XDTE4MDQxMTA3NTgyOFoX")
loSbTppCert.Append("DTIzMDQxMTA3NTgyOFowgYkxCzAJBgNVBAYTAk5MMRAwDgYDVQQIDAdVdHJlY2h0")
loSbTppCert.Append("MRAwDgYDVQQHDAdVdHJlY2h0MREwDwYDVQQKDAhSYWJvYmFuazEcMBoGA1UECwwT")
loSbTppCert.Append("T25saW5lIFRyYW5zYWN0aW9uczElMCMGA1UEAwwcUFNEMiBBUEkgUEkgU2Vydmlj")
loSbTppCert.Append("ZXMgU2FuZGJveDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANoAjqGW")
loSbTppCert.Append("UgCIm2F+0sBSEwLal+T3u+uldLikpxHCB8iL1GD7FrRjcA+MVsxhvHly7vRsHK+t")
loSbTppCert.Append("QyMSaeK782RHpY33qxPLc8LmoQLb2EuiQxXj9POYkYBQ74qkrZnvKVlR3WoyQWeD")
loSbTppCert.Append("OXnSY2wbNFfkP8ET4ElwyuIIEriwYhab0OIrnnrO8X82/SPZxHwEd3aQjQ6uhiw8")
loSbTppCert.Append("paDspJbS5WjEfuwY16KVVUYlhbtAwGjvc6aK0NBm+LH9fMLpAE6gfGZNy0gzMDor")
loSbTppCert.Append("VNbkQK1IoAGD8p9ZHdB0F3FwkILEjUiQW6nK+/fKDNJ0TBbpgZUpY8bR460qzxKd")
loSbTppCert.Append("eZ1yPDqX2Cjh6fkCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAYL4iD6noMJAt63kD")
loSbTppCert.Append("ED4RB2mII/lssvHhcxuDpOm3Ims9urubFWEpvV5TgIBAxy9PBinOdjhO1kGJJnYi")
loSbTppCert.Append("7F1jv1qnZwTV1JhYbvxv3+vk0jaiu7Ew7G3ASlzruXyMhN6t6jk9MpaWGl5Uw1T+")
loSbTppCert.Append("gNRUcWQRR44g3ahQRIS/UHkaV+vcpOa8j186/1X0ULHfbcVQk4LMmJeXqNs8sBAU")
loSbTppCert.Append("dKU/c6ssvj8jfJ4SfrurcBhY5UBTOdQOXTPY85aU3iFloerx7Oi9EHewxInOrU5X")
loSbTppCert.Append("zqqTz2AQPXezexVeAQxP27lzqCmYC7CFiam6QBr06VebkmnPLfs76n8CDc1cwE6g")
loSbTppCert.Append("Ul0rMA==")
loHttp.SetRequestHeader("tpp-signature-certificate",loSbTppCert.GetAsString())

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

* ----------------------------------------------------------------
* X-Request-ID header...
* Generate a UUID v4.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Crypt2')
loCrypt = CreateObject('Chilkat.Crypt2')
lcXRequestId = loCrypt.GenerateUuid()
loHttp.SetRequestHeader("x-request-id",lcXRequestId)

* ----------------------------------------------------------------
* Date header...
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.CkDateTime')
loDt = CreateObject('Chilkat.CkDateTime')
loDt.SetFromCurrentSystemTime()
lcDateHdrVal = loDt.GetAsRfc822(0)
* The desire date/time format is the "RFC822" format.
loHttp.SetRequestHeader("Date",lcDateHdrVal)

* ----------------------------------------------------------------
* Digest header...
loCrypt.HashAlgorithm = "SHA256"
loCrypt.EncodingMode = "base64"
* A GET request has no HTTP request body.  Therefore the payload is the empty string.
lcPayload = ""
lcPayloadDigest = loCrypt.HashStringENC(lcPayload)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbDigestHdrVal = CreateObject('Chilkat.StringBuilder')
loSbDigestHdrVal.Append("SHA-256=")
loSbDigestHdrVal.Append(lcPayloadDigest)
loHttp.SetRequestHeader("digest",loSbDigestHdrVal.GetAsString())

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbStringToSign = CreateObject('Chilkat.StringBuilder')
loSbStringToSign.Append("date: ")
loSbStringToSign.AppendLine(lcDateHdrVal,0)
loSbStringToSign.Append("digest: ")
loSbStringToSign.AppendLine(loSbDigestHdrVal.GetAsString(),0)
loSbStringToSign.Append("x-request-id: ")
loSbStringToSign.Append(lcXRequestId)

* ----------------------------------------------------------------
* Sign with our private key...
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbPrivKey = CreateObject('Chilkat.StringBuilder')
loSbPrivKey.Append("MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDaAI6hllIAiJth")
loSbPrivKey.Append("ftLAUhMC2pfk97vrpXS4pKcRwgfIi9Rg+xa0Y3APjFbMYbx5cu70bByvrUMjEmni")
loSbPrivKey.Append("u/NkR6WN96sTy3PC5qEC29hLokMV4/TzmJGAUO+KpK2Z7ylZUd1qMkFngzl50mNs")
loSbPrivKey.Append("GzRX5D/BE+BJcMriCBK4sGIWm9DiK556zvF/Nv0j2cR8BHd2kI0OroYsPKWg7KSW")
loSbPrivKey.Append("0uVoxH7sGNeilVVGJYW7QMBo73OmitDQZvix/XzC6QBOoHxmTctIMzA6K1TW5ECt")
loSbPrivKey.Append("SKABg/KfWR3QdBdxcJCCxI1IkFupyvv3ygzSdEwW6YGVKWPG0eOtKs8SnXmdcjw6")
loSbPrivKey.Append("l9go4en5AgMBAAECggEAB8nsTqalwGIhFw8mbXuhNUFlGuek/arYLD6pv28swwQH")
loSbPrivKey.Append("7v0ZlxFUcCHF+iBl0PsDwZTZQ4ePtgGS6ehoLkWHCzb1lEv5E1YVG5qKNE2UUwRl")
loSbPrivKey.Append("fIyPakO6AzyV/UF3uzq7C+/GuXGNTKZxKewg5yD/DCFvKoCOpxu9u36FyqP/hw0S")
loSbPrivKey.Append("ADVlmp35/zoPDPZzu1j4FiCo0pJ9LwJcHxeJHopNAKDw9k6I4z/grskdgupsGzK2")
loSbPrivKey.Append("BiGiQ/+wmmO68/6Xa6KWfpr1PQ6ODJHgzZsdGCVi6Ebaqlj6BbsYWxP6h3lrsGt+")
loSbPrivKey.Append("LmHBaN2jCD6cDp+lihqFgnm8hfdv0lmbPilp71EDfwKBgQD6U8PBzZtN8yXm5WuS")
loSbPrivKey.Append("NL+/8q5GjNmeTJBSo1gM6Y8vOT4QAE147LbVuVBDwyHPoSrNejePae6Q14PswjBy")
loSbPrivKey.Append("T7B8DZ0OeQyGa3trrFg/ib7Vv4ZMvJqX9+WzBrzZsxTg7oCKHzmCR4vIRItKHH3z")
loSbPrivKey.Append("Wnnhqlo8ic2AZ2O43cdJosbO1wKBgQDe8UODOLu0vnHohOKeUqF3w/ZOB2+83/js")
loSbPrivKey.Append("YyUbSkzsGvHIwTjObuMUFTQvdMZ6IkIyJdfnDZIbvlBSD8tzL5iKFTNCK2nL1i4G")
loSbPrivKey.Append("iFr0CYLaHAlhJ5GEbTrTMDoJeBPerZq83HPrSa/Wb0xO18QTWsoVQPFfPFbbcQyI")
loSbPrivKey.Append("9ryJ2iIDrwKBgQC6kuAefG46ZPVk6K2KZUJdgDUgZC52a75NuW0RAqszmUiGiJM1")
loSbPrivKey.Append("g8ip9tq6BqAWrprGV0c93shusBKlzf5p1LdHXqYmeVY6gbWVhPipMrNHgN5KJ3BZ")
loSbPrivKey.Append("v+w1yNnMsErpcxne2HL2hPjMJTpj3GSLkm2xIlTrNhIyl9ydlr7IRUhENQKBgQCv")
loSbPrivKey.Append("i6HxbXa/90WSJTCcIcxqla8X+dsOCf3jhJ3vQy4Wq5C+1wZ35fCAG8Ifq/+so9Uj")
loSbPrivKey.Append("z5CVqqXlmpF8TFuSs2OVNuRJsg14J4nOMwgLKIIUZAcurQ10DN5I9Kx+UEK1EFXL")
loSbPrivKey.Append("aHsORdNjMfgQDO2jn9WHrr9gkg6CdB2+qyoCEfS+mQKBgBW08lcy9V5RzRWb/v/j")
loSbPrivKey.Append("xsc7ovmgAhCJhDeV7dPbx4HbFeoQJlbA8g1thdcFlcatSGyNDbvNE1GPSd4NhkpR")
loSbPrivKey.Append("Y6Hfv53kdEzjVkEtU8lUdL7HNVJqX7bU7oZlfbYcwxWQ1Gg8C1oLIAyEt71slQtd")
loSbPrivKey.Append("RiNYBRZTQe2F0wxbXnuUqLAw")

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.PrivateKey')
loPrivKey = CreateObject('Chilkat.PrivateKey')
lnSuccess = loPrivKey.LoadPem(loSbPrivKey.GetAsString())
IF (lnSuccess = 0) THEN
    ? loPrivKey.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Rsa')
loRsa = CreateObject('Chilkat.Rsa')
lnSuccess = loRsa.ImportPrivateKeyObj(loPrivKey)
IF (lnSuccess = 0) THEN
    ? loRsa.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    CANCEL
ENDIF

loRsa.EncodingMode = "base64"
lcB64Signature = loRsa.SignStringENC(loSbStringToSign.GetAsString(),"SHA256")

* ----------------------------------------------------------------
* 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. 
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Cert')
loCert = CreateObject('Chilkat.Cert')
lnSuccess = loCert.SetFromEncoded(loSbTppCert.GetAsString())
IF (lnSuccess = 0) THEN
    ? loCert.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    RELEASE loCert
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbSigHdrVal = CreateObject('Chilkat.StringBuilder')
loSbSigHdrVal.Append('keyId="')
loSbSigHdrVal.Append(loCert.SerialDecimal)
loSbSigHdrVal.Append('",')
loSbSigHdrVal.Append('algorithm="rsa-sha256",')
loSbSigHdrVal.Append('headers="date digest x-request-id",')
loSbSigHdrVal.Append('signature="')
loSbSigHdrVal.Append(lcB64Signature)
loSbSigHdrVal.Append('"')

loHttp.SetRequestHeader("signature",loSbSigHdrVal.GetAsString())

* ----------------------------------------------------------------
* Add remaining headers...

loHttp.SetRequestHeader("x-ibm-client-id","YOUR_APP_CLIENT_ID")
loHttp.SetRequestHeader("accept","application/json")

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Cert')
loTlsCert = CreateObject('Chilkat.Cert')
lnSuccess = loTlsCert.LoadFromFile("qa_data/certs_and_keys/ING/example_client_tls.cer")
IF (lnSuccess = 0) THEN
    ? loTlsCert.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    RELEASE loCert
    RELEASE loSbSigHdrVal
    RELEASE loTlsCert
    CANCEL
ENDIF

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.BinData')
loBdPrivKey = CreateObject('Chilkat.BinData')
lnSuccess = loBdPrivKey.LoadFile("qa_data/certs_and_keys/ING/example_client_tls.key")
IF (lnSuccess = 0) THEN
    ? "Failed to load example_client_tls.key"
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    RELEASE loCert
    RELEASE loSbSigHdrVal
    RELEASE loTlsCert
    RELEASE loBdPrivKey
    CANCEL
ENDIF

* 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.

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.PrivateKey')
loTlsPrivKey = CreateObject('Chilkat.PrivateKey')
lnSuccess = loTlsPrivKey.LoadAnyFormat(loBdPrivKey,"")
IF (lnSuccess = 0) THEN
    ? loTlsPrivKey.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    RELEASE loCert
    RELEASE loSbSigHdrVal
    RELEASE loTlsCert
    RELEASE loBdPrivKey
    RELEASE loTlsPrivKey
    CANCEL
ENDIF

* Associate the private key with the certificate.
lnSuccess = loTlsCert.SetPrivateKey(loTlsPrivKey)
IF (lnSuccess = 0) THEN
    ? loTlsCert.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    RELEASE loCert
    RELEASE loSbSigHdrVal
    RELEASE loTlsCert
    RELEASE loBdPrivKey
    RELEASE loTlsPrivKey
    CANCEL
ENDIF

lnSuccess = loHttp.SetSslClientCert(loTlsCert)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    RELEASE loCert
    RELEASE loSbSigHdrVal
    RELEASE loTlsCert
    RELEASE loBdPrivKey
    RELEASE loTlsPrivKey
    CANCEL
ENDIF

* ----------------------------------------------------------------
* Finally, send the request...

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://api-sandbox.rabobank.nl/openapi/sandbox/payments/account-information/ais/v3/accounts",loSbResponseBody)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    ? loSbResponseBody.GetAsString()
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    RELEASE loCert
    RELEASE loSbSigHdrVal
    RELEASE loTlsCert
    RELEASE loBdPrivKey
    RELEASE loTlsPrivKey
    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 loJsonToken
    RELEASE loSbTppCert
    RELEASE loCrypt
    RELEASE loDt
    RELEASE loSbDigestHdrVal
    RELEASE loSbStringToSign
    RELEASE loSbPrivKey
    RELEASE loPrivKey
    RELEASE loRsa
    RELEASE loCert
    RELEASE loSbSigHdrVal
    RELEASE loTlsCert
    RELEASE loBdPrivKey
    RELEASE loTlsPrivKey
    RELEASE loSbResponseBody
    RELEASE loJResp
    CANCEL
ENDIF

* 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

i = 0
lnCount_i = loJResp.SizeOfArray("accounts")
DO WHILE i < lnCount_i
    loJResp.I = i
    lcV_linksAccount = loJResp.StringOf("accounts[i]._links.account")
    lcV_linksBalances = loJResp.StringOf("accounts[i]._links.balances")
    lcV_linksTransactions = loJResp.StringOf("accounts[i]._links.transactions")
    lcCurrency = loJResp.StringOf("accounts[i].currency")
    lcIban = loJResp.StringOf("accounts[i].iban")
    lcName = loJResp.StringOf("accounts[i].name")
    lcResourceId = loJResp.StringOf("accounts[i].resourceId")
    lcStatus = loJResp.StringOf("accounts[i].status")
    i = i + 1
ENDDO

RELEASE loHttp
RELEASE loJsonToken
RELEASE loSbTppCert
RELEASE loCrypt
RELEASE loDt
RELEASE loSbDigestHdrVal
RELEASE loSbStringToSign
RELEASE loSbPrivKey
RELEASE loPrivKey
RELEASE loRsa
RELEASE loCert
RELEASE loSbSigHdrVal
RELEASE loTlsCert
RELEASE loBdPrivKey
RELEASE loTlsPrivKey
RELEASE loSbResponseBody
RELEASE loJResp


 

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