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

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

 

 

 

(PowerBuilder) 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

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_JsonToken
oleobject loo_SbTppCert
oleobject loo_Crypt
string ls_XRequestId
oleobject loo_Dt
string ls_DateHdrVal
string ls_Payload
string ls_PayloadDigest
oleobject loo_SbDigestHdrVal
oleobject loo_SbStringToSign
oleobject loo_SbPrivKey
oleobject loo_PrivKey
oleobject loo_Rsa
string ls_B64Signature
oleobject loo_Cert
oleobject loo_SbSigHdrVal
oleobject loo_TlsCert
oleobject loo_BdPrivKey
oleobject loo_TlsPrivKey
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_V_linksAccount
string ls_V_linksBalances
string ls_V_linksTransactions
string ls_Currency
string ls_Iban
string ls_Name
string ls_ResourceId
string ls_Status
integer i
integer li_Count_i

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// 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.
loo_JsonToken = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JsonToken.ConnectToNewObject("Chilkat.JsonObject")

li_Success = loo_JsonToken.LoadFile("qa_data/tokens/rabobank.json")
if li_Success = 0 then
    Write-Debug loo_JsonToken.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    return
end if

// This adds the "authorization: Bearer REPLACE_BEARER_TOKEN" header.
loo_Http.AuthToken = loo_JsonToken.StringOf("access_token")

// This is the TTP Signature certificate: The certificate used for signing the request.
loo_SbTppCert = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbTppCert.ConnectToNewObject("Chilkat.StringBuilder")

loo_SbTppCert.Append("MIIDkDCCAnigAwIBAgIEWs3AJDANBgkqhkiG9w0BAQsFADCBiTELMAkGA1UEBhMC")
loo_SbTppCert.Append("TkwxEDAOBgNVBAgMB1V0cmVjaHQxEDAOBgNVBAcMB1V0cmVjaHQxETAPBgNVBAoM")
loo_SbTppCert.Append("CFJhYm9iYW5rMRwwGgYDVQQLDBNPbmxpbmUgVHJhbnNhY3Rpb25zMSUwIwYDVQQD")
loo_SbTppCert.Append("DBxQU0QyIEFQSSBQSSBTZXJ2aWNlcyBTYW5kYm94MB4XDTE4MDQxMTA3NTgyOFoX")
loo_SbTppCert.Append("DTIzMDQxMTA3NTgyOFowgYkxCzAJBgNVBAYTAk5MMRAwDgYDVQQIDAdVdHJlY2h0")
loo_SbTppCert.Append("MRAwDgYDVQQHDAdVdHJlY2h0MREwDwYDVQQKDAhSYWJvYmFuazEcMBoGA1UECwwT")
loo_SbTppCert.Append("T25saW5lIFRyYW5zYWN0aW9uczElMCMGA1UEAwwcUFNEMiBBUEkgUEkgU2Vydmlj")
loo_SbTppCert.Append("ZXMgU2FuZGJveDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANoAjqGW")
loo_SbTppCert.Append("UgCIm2F+0sBSEwLal+T3u+uldLikpxHCB8iL1GD7FrRjcA+MVsxhvHly7vRsHK+t")
loo_SbTppCert.Append("QyMSaeK782RHpY33qxPLc8LmoQLb2EuiQxXj9POYkYBQ74qkrZnvKVlR3WoyQWeD")
loo_SbTppCert.Append("OXnSY2wbNFfkP8ET4ElwyuIIEriwYhab0OIrnnrO8X82/SPZxHwEd3aQjQ6uhiw8")
loo_SbTppCert.Append("paDspJbS5WjEfuwY16KVVUYlhbtAwGjvc6aK0NBm+LH9fMLpAE6gfGZNy0gzMDor")
loo_SbTppCert.Append("VNbkQK1IoAGD8p9ZHdB0F3FwkILEjUiQW6nK+/fKDNJ0TBbpgZUpY8bR460qzxKd")
loo_SbTppCert.Append("eZ1yPDqX2Cjh6fkCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAYL4iD6noMJAt63kD")
loo_SbTppCert.Append("ED4RB2mII/lssvHhcxuDpOm3Ims9urubFWEpvV5TgIBAxy9PBinOdjhO1kGJJnYi")
loo_SbTppCert.Append("7F1jv1qnZwTV1JhYbvxv3+vk0jaiu7Ew7G3ASlzruXyMhN6t6jk9MpaWGl5Uw1T+")
loo_SbTppCert.Append("gNRUcWQRR44g3ahQRIS/UHkaV+vcpOa8j186/1X0ULHfbcVQk4LMmJeXqNs8sBAU")
loo_SbTppCert.Append("dKU/c6ssvj8jfJ4SfrurcBhY5UBTOdQOXTPY85aU3iFloerx7Oi9EHewxInOrU5X")
loo_SbTppCert.Append("zqqTz2AQPXezexVeAQxP27lzqCmYC7CFiam6QBr06VebkmnPLfs76n8CDc1cwE6g")
loo_SbTppCert.Append("Ul0rMA==")
loo_Http.SetRequestHeader("tpp-signature-certificate",loo_SbTppCert.GetAsString())

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

// ----------------------------------------------------------------
// X-Request-ID header...
// Generate a UUID v4.
loo_Crypt = create oleobject
// Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")

ls_XRequestId = loo_Crypt.GenerateUuid()
loo_Http.SetRequestHeader("x-request-id",ls_XRequestId)

// ----------------------------------------------------------------
// Date header...
loo_Dt = create oleobject
// Use "Chilkat_9_5_0.CkDateTime" for versions of Chilkat < 10.0.0
li_rc = loo_Dt.ConnectToNewObject("Chilkat.CkDateTime")

loo_Dt.SetFromCurrentSystemTime()
ls_DateHdrVal = loo_Dt.GetAsRfc822(0)
// The desire date/time format is the "RFC822" format.
loo_Http.SetRequestHeader("Date",ls_DateHdrVal)

// ----------------------------------------------------------------
// Digest header...
loo_Crypt.HashAlgorithm = "SHA256"
loo_Crypt.EncodingMode = "base64"
// A GET request has no HTTP request body.  Therefore the payload is the empty string.
ls_Payload = ""
ls_PayloadDigest = loo_Crypt.HashStringENC(ls_Payload)
loo_SbDigestHdrVal = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbDigestHdrVal.ConnectToNewObject("Chilkat.StringBuilder")

loo_SbDigestHdrVal.Append("SHA-256=")
loo_SbDigestHdrVal.Append(ls_PayloadDigest)
loo_Http.SetRequestHeader("digest",loo_SbDigestHdrVal.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

loo_SbStringToSign = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbStringToSign.ConnectToNewObject("Chilkat.StringBuilder")

loo_SbStringToSign.Append("date: ")
loo_SbStringToSign.AppendLine(ls_DateHdrVal,0)
loo_SbStringToSign.Append("digest: ")
loo_SbStringToSign.AppendLine(loo_SbDigestHdrVal.GetAsString(),0)
loo_SbStringToSign.Append("x-request-id: ")
loo_SbStringToSign.Append(ls_XRequestId)

// ----------------------------------------------------------------
// Sign with our private key...
loo_SbPrivKey = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbPrivKey.ConnectToNewObject("Chilkat.StringBuilder")

loo_SbPrivKey.Append("MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDaAI6hllIAiJth")
loo_SbPrivKey.Append("ftLAUhMC2pfk97vrpXS4pKcRwgfIi9Rg+xa0Y3APjFbMYbx5cu70bByvrUMjEmni")
loo_SbPrivKey.Append("u/NkR6WN96sTy3PC5qEC29hLokMV4/TzmJGAUO+KpK2Z7ylZUd1qMkFngzl50mNs")
loo_SbPrivKey.Append("GzRX5D/BE+BJcMriCBK4sGIWm9DiK556zvF/Nv0j2cR8BHd2kI0OroYsPKWg7KSW")
loo_SbPrivKey.Append("0uVoxH7sGNeilVVGJYW7QMBo73OmitDQZvix/XzC6QBOoHxmTctIMzA6K1TW5ECt")
loo_SbPrivKey.Append("SKABg/KfWR3QdBdxcJCCxI1IkFupyvv3ygzSdEwW6YGVKWPG0eOtKs8SnXmdcjw6")
loo_SbPrivKey.Append("l9go4en5AgMBAAECggEAB8nsTqalwGIhFw8mbXuhNUFlGuek/arYLD6pv28swwQH")
loo_SbPrivKey.Append("7v0ZlxFUcCHF+iBl0PsDwZTZQ4ePtgGS6ehoLkWHCzb1lEv5E1YVG5qKNE2UUwRl")
loo_SbPrivKey.Append("fIyPakO6AzyV/UF3uzq7C+/GuXGNTKZxKewg5yD/DCFvKoCOpxu9u36FyqP/hw0S")
loo_SbPrivKey.Append("ADVlmp35/zoPDPZzu1j4FiCo0pJ9LwJcHxeJHopNAKDw9k6I4z/grskdgupsGzK2")
loo_SbPrivKey.Append("BiGiQ/+wmmO68/6Xa6KWfpr1PQ6ODJHgzZsdGCVi6Ebaqlj6BbsYWxP6h3lrsGt+")
loo_SbPrivKey.Append("LmHBaN2jCD6cDp+lihqFgnm8hfdv0lmbPilp71EDfwKBgQD6U8PBzZtN8yXm5WuS")
loo_SbPrivKey.Append("NL+/8q5GjNmeTJBSo1gM6Y8vOT4QAE147LbVuVBDwyHPoSrNejePae6Q14PswjBy")
loo_SbPrivKey.Append("T7B8DZ0OeQyGa3trrFg/ib7Vv4ZMvJqX9+WzBrzZsxTg7oCKHzmCR4vIRItKHH3z")
loo_SbPrivKey.Append("Wnnhqlo8ic2AZ2O43cdJosbO1wKBgQDe8UODOLu0vnHohOKeUqF3w/ZOB2+83/js")
loo_SbPrivKey.Append("YyUbSkzsGvHIwTjObuMUFTQvdMZ6IkIyJdfnDZIbvlBSD8tzL5iKFTNCK2nL1i4G")
loo_SbPrivKey.Append("iFr0CYLaHAlhJ5GEbTrTMDoJeBPerZq83HPrSa/Wb0xO18QTWsoVQPFfPFbbcQyI")
loo_SbPrivKey.Append("9ryJ2iIDrwKBgQC6kuAefG46ZPVk6K2KZUJdgDUgZC52a75NuW0RAqszmUiGiJM1")
loo_SbPrivKey.Append("g8ip9tq6BqAWrprGV0c93shusBKlzf5p1LdHXqYmeVY6gbWVhPipMrNHgN5KJ3BZ")
loo_SbPrivKey.Append("v+w1yNnMsErpcxne2HL2hPjMJTpj3GSLkm2xIlTrNhIyl9ydlr7IRUhENQKBgQCv")
loo_SbPrivKey.Append("i6HxbXa/90WSJTCcIcxqla8X+dsOCf3jhJ3vQy4Wq5C+1wZ35fCAG8Ifq/+so9Uj")
loo_SbPrivKey.Append("z5CVqqXlmpF8TFuSs2OVNuRJsg14J4nOMwgLKIIUZAcurQ10DN5I9Kx+UEK1EFXL")
loo_SbPrivKey.Append("aHsORdNjMfgQDO2jn9WHrr9gkg6CdB2+qyoCEfS+mQKBgBW08lcy9V5RzRWb/v/j")
loo_SbPrivKey.Append("xsc7ovmgAhCJhDeV7dPbx4HbFeoQJlbA8g1thdcFlcatSGyNDbvNE1GPSd4NhkpR")
loo_SbPrivKey.Append("Y6Hfv53kdEzjVkEtU8lUdL7HNVJqX7bU7oZlfbYcwxWQ1Gg8C1oLIAyEt71slQtd")
loo_SbPrivKey.Append("RiNYBRZTQe2F0wxbXnuUqLAw")

loo_PrivKey = create oleobject
// Use "Chilkat_9_5_0.PrivateKey" for versions of Chilkat < 10.0.0
li_rc = loo_PrivKey.ConnectToNewObject("Chilkat.PrivateKey")

li_Success = loo_PrivKey.LoadPem(loo_SbPrivKey.GetAsString())
if li_Success = 0 then
    Write-Debug loo_PrivKey.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    return
end if

loo_Rsa = create oleobject
// Use "Chilkat_9_5_0.Rsa" for versions of Chilkat < 10.0.0
li_rc = loo_Rsa.ConnectToNewObject("Chilkat.Rsa")

li_Success = loo_Rsa.ImportPrivateKeyObj(loo_PrivKey)
if li_Success = 0 then
    Write-Debug loo_Rsa.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    return
end if

loo_Rsa.EncodingMode = "base64"
ls_B64Signature = loo_Rsa.SignStringENC(loo_SbStringToSign.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. 
loo_Cert = create oleobject
// Use "Chilkat_9_5_0.Cert" for versions of Chilkat < 10.0.0
li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert")

li_Success = loo_Cert.SetFromEncoded(loo_SbTppCert.GetAsString())
if li_Success = 0 then
    Write-Debug loo_Cert.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    destroy loo_Cert
    return
end if

loo_SbSigHdrVal = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbSigHdrVal.ConnectToNewObject("Chilkat.StringBuilder")

loo_SbSigHdrVal.Append("keyId=~"")
loo_SbSigHdrVal.Append(loo_Cert.SerialDecimal)
loo_SbSigHdrVal.Append("~",")
loo_SbSigHdrVal.Append("algorithm=~"rsa-sha256~",")
loo_SbSigHdrVal.Append("headers=~"date digest x-request-id~",")
loo_SbSigHdrVal.Append("signature=~"")
loo_SbSigHdrVal.Append(ls_B64Signature)
loo_SbSigHdrVal.Append("~"")

loo_Http.SetRequestHeader("signature",loo_SbSigHdrVal.GetAsString())

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

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

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

loo_TlsCert = create oleobject
// Use "Chilkat_9_5_0.Cert" for versions of Chilkat < 10.0.0
li_rc = loo_TlsCert.ConnectToNewObject("Chilkat.Cert")

li_Success = loo_TlsCert.LoadFromFile("qa_data/certs_and_keys/ING/example_client_tls.cer")
if li_Success = 0 then
    Write-Debug loo_TlsCert.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    destroy loo_Cert
    destroy loo_SbSigHdrVal
    destroy loo_TlsCert
    return
end if

loo_BdPrivKey = create oleobject
// Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0
li_rc = loo_BdPrivKey.ConnectToNewObject("Chilkat.BinData")

li_Success = loo_BdPrivKey.LoadFile("qa_data/certs_and_keys/ING/example_client_tls.key")
if li_Success = 0 then
    Write-Debug "Failed to load example_client_tls.key"
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    destroy loo_Cert
    destroy loo_SbSigHdrVal
    destroy loo_TlsCert
    destroy loo_BdPrivKey
    return
end if

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

loo_TlsPrivKey = create oleobject
// Use "Chilkat_9_5_0.PrivateKey" for versions of Chilkat < 10.0.0
li_rc = loo_TlsPrivKey.ConnectToNewObject("Chilkat.PrivateKey")

li_Success = loo_TlsPrivKey.LoadAnyFormat(loo_BdPrivKey,"")
if li_Success = 0 then
    Write-Debug loo_TlsPrivKey.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    destroy loo_Cert
    destroy loo_SbSigHdrVal
    destroy loo_TlsCert
    destroy loo_BdPrivKey
    destroy loo_TlsPrivKey
    return
end if

// Associate the private key with the certificate.
li_Success = loo_TlsCert.SetPrivateKey(loo_TlsPrivKey)
if li_Success = 0 then
    Write-Debug loo_TlsCert.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    destroy loo_Cert
    destroy loo_SbSigHdrVal
    destroy loo_TlsCert
    destroy loo_BdPrivKey
    destroy loo_TlsPrivKey
    return
end if

li_Success = loo_Http.SetSslClientCert(loo_TlsCert)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    destroy loo_Cert
    destroy loo_SbSigHdrVal
    destroy loo_TlsCert
    destroy loo_BdPrivKey
    destroy loo_TlsPrivKey
    return
end if

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

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://api-sandbox.rabobank.nl/openapi/sandbox/payments/account-information/ais/v3/accounts",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    Write-Debug loo_SbResponseBody.GetAsString()
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    destroy loo_Cert
    destroy loo_SbSigHdrVal
    destroy loo_TlsCert
    destroy loo_BdPrivKey
    destroy loo_TlsPrivKey
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbTppCert
    destroy loo_Crypt
    destroy loo_Dt
    destroy loo_SbDigestHdrVal
    destroy loo_SbStringToSign
    destroy loo_SbPrivKey
    destroy loo_PrivKey
    destroy loo_Rsa
    destroy loo_Cert
    destroy loo_SbSigHdrVal
    destroy loo_TlsCert
    destroy loo_BdPrivKey
    destroy loo_TlsPrivKey
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// 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
li_Count_i = loo_JResp.SizeOfArray("accounts")
do while i < li_Count_i
    loo_JResp.I = i
    ls_V_linksAccount = loo_JResp.StringOf("accounts[i]._links.account")
    ls_V_linksBalances = loo_JResp.StringOf("accounts[i]._links.balances")
    ls_V_linksTransactions = loo_JResp.StringOf("accounts[i]._links.transactions")
    ls_Currency = loo_JResp.StringOf("accounts[i].currency")
    ls_Iban = loo_JResp.StringOf("accounts[i].iban")
    ls_Name = loo_JResp.StringOf("accounts[i].name")
    ls_ResourceId = loo_JResp.StringOf("accounts[i].resourceId")
    ls_Status = loo_JResp.StringOf("accounts[i].status")
    i = i + 1
loop


destroy loo_Http
destroy loo_JsonToken
destroy loo_SbTppCert
destroy loo_Crypt
destroy loo_Dt
destroy loo_SbDigestHdrVal
destroy loo_SbStringToSign
destroy loo_SbPrivKey
destroy loo_PrivKey
destroy loo_Rsa
destroy loo_Cert
destroy loo_SbSigHdrVal
destroy loo_TlsCert
destroy loo_BdPrivKey
destroy loo_TlsPrivKey
destroy loo_SbResponseBody
destroy loo_JResp

 

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