Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Ibanity XS2A List Financial InstitutionsSee more Ibanity ExamplesDemonstrates how to send a request to get a list of financial institutions. For more information, see https://documentation.ibanity.com/xs2a/api/curl#authentication
Use ChilkatAx-win32.pkg Procedure Test Variant vCert Handle hoCert Boolean iSuccess Handle hoDtNow String sCreated Handle hoCrypt2 Handle hoSbDigestHdrValue String sRequest_target Handle hoSbSigningString String sSigned_headers_list Variant vPrivKey Handle hoPrivKey Handle hoRsa String sSigBase64 Handle hoSbSigHeaderValue Handle hoHttp Variant vSbResponseBody Handle hoSbResponseBody Handle hoJResp Integer iRespStatusCode String sAttributesBic Boolean iAttributesBulkPaymentsEnabled String sAttributesCountry Boolean iAttributesFinancialInstitutionCustomerReferenceRequired Boolean iAttributesFutureDatedPaymentsAllowed String sAttributesLogoUrl String sAttributesMaintenanceFrom String sAttributesMaintenanceTo String sAttributesMaintenanceType String sAttributesMaxRequestedAccountReferences Integer iAttributesMinRequestedAccountReferences String sAttributesName Boolean iAttributesPaymentsEnabled Boolean iAttributesPeriodicPaymentsEnabled String sAttributesPrimaryColor Boolean iAttributesRequiresCredentialStorage Boolean iAttributesRequiresCustomerIpAddress Boolean iAttributesSandbox String sAttributesSecondaryColor String sAttributesSharedBrandName String sAttributesSharedBrandReference String sAttributesStatus String sId String sLinksSelf String sV_type Integer j Integer iCount_j String sStrVal String sLinksFirst Integer iMetaPagingLimit Integer i Integer iCount_i String sTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // Send the following request: // $ curl -X GET https://api.ibanity.com/xs2a/financial-institutions \ // --cert certificate.pem \ // --key private_key.pem \ // -H 'Signature: keyId="75b5d796-de5c-400a-81ce-e72371b01cbc",created=1599659223,algorithm="hs2019",headers="(request-target) digest (created) host",signature="BASE64(RSA-SHA256(SIGNING_STRING))"' \ // -H 'Digest: SHA-512=beDaRguyEb8fhh5wnl37bOTDtvhuYZyZNkTZ9LiC9Wc=' // Ibanity provides the certificate + private key in PFX format. This example will use the .pfx instead of the pair of PEM files. // (It is also possible to implement using Chilkat with the PEM files, but PFX is easier.) Get Create (RefClass(cComChilkatCert)) To hoCert If (Not(IsComObjectCreated(hoCert))) Begin Send CreateComObject of hoCert End Get ComLoadPfxFile Of hoCert "qa_data/pfx/my_ibanity_certificate.pfx" "my_pfx_password" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoCert To sTemp1 Showln sTemp1 Procedure_Return End // We need to calculate the Digest and Signature header fields. // For a detailed explanation, see Calculate Ibanity HTTP Signature Example // We'll just write the code here as briefly as possible. Get Create (RefClass(cComCkDateTime)) To hoDtNow If (Not(IsComObjectCreated(hoDtNow))) Begin Send CreateComObject of hoDtNow End Get ComSetFromCurrentSystemTime Of hoDtNow To iSuccess Get ComGetAsUnixTimeStr Of hoDtNow False To sCreated Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt2 If (Not(IsComObjectCreated(hoCrypt2))) Begin Send CreateComObject of hoCrypt2 End Set ComHashAlgorithm Of hoCrypt2 To "sha512" Set ComEncodingMode Of hoCrypt2 To "base64" Get Create (RefClass(cComChilkatStringBuilder)) To hoSbDigestHdrValue If (Not(IsComObjectCreated(hoSbDigestHdrValue))) Begin Send CreateComObject of hoSbDigestHdrValue End Get ComAppend Of hoSbDigestHdrValue "SHA-512=" To iSuccess // GET requests have empty payloads. The SHA-512 hash of the empty string is the same for all GET requests. // Therefore all GET requests will use "z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==" // You can eliminate the explicit hash computation (for GET requests) and simply use the above literal string. Get ComHashStringENC Of hoCrypt2 "" To sTemp1 Get ComAppend Of hoSbDigestHdrValue sTemp1 To iSuccess Showln "Generated Digest" Get ComGetAsString Of hoSbDigestHdrValue To sTemp1 Showln sTemp1 Move "get /xs2a/financial-institutions" To sRequest_target Get Create (RefClass(cComChilkatStringBuilder)) To hoSbSigningString If (Not(IsComObjectCreated(hoSbSigningString))) Begin Send CreateComObject of hoSbSigningString End Get ComAppend Of hoSbSigningString "(request-target): " To iSuccess Get ComAppendLine Of hoSbSigningString sRequest_target False To iSuccess Get ComAppend Of hoSbSigningString "host: " To iSuccess Get ComAppendLine Of hoSbSigningString "api.ibanity.com" False To iSuccess Get ComAppend Of hoSbSigningString "digest: " To iSuccess Get ComGetAsString Of hoSbDigestHdrValue To sTemp1 Get ComAppendLine Of hoSbSigningString sTemp1 False To iSuccess Get ComAppend Of hoSbSigningString "(created): " To iSuccess Get ComAppend Of hoSbSigningString sCreated To iSuccess // ibanity-idempotency-key is not used with GET requests. Showln "Signing String:" Get ComGetAsString Of hoSbSigningString To sTemp1 Showln sTemp1 Move "(request-target) host digest (created)" To sSigned_headers_list Get Create (RefClass(cComChilkatPrivateKey)) To hoPrivKey If (Not(IsComObjectCreated(hoPrivKey))) Begin Send CreateComObject of hoPrivKey End Get ComLoadEncryptedPemFile Of hoPrivKey "my_ibanity_signature_private_key.pem" "pem_password" 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 Set ComPssSaltLen Of hoRsa To 32 Set ComEncodingMode Of hoRsa To "base64" // Use the RSASSA-PSS signature algorithm Set ComOaepPadding Of hoRsa To True 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 // Sign the signing string. Get ComGetAsString Of hoSbSigningString To sTemp1 Get ComSignStringENC Of hoRsa sTemp1 "sha-256" To sSigBase64 Get ComLastMethodSuccess Of hoRsa To bTemp1 If (bTemp1 = False) Begin Get ComLastErrorText Of hoRsa To sTemp1 Showln sTemp1 Procedure_Return End Showln "Signature:" Showln sSigBase64 // Build the signature header value. Get Create (RefClass(cComChilkatStringBuilder)) To hoSbSigHeaderValue If (Not(IsComObjectCreated(hoSbSigHeaderValue))) Begin Send CreateComObject of hoSbSigHeaderValue End Get ComAppend Of hoSbSigHeaderValue 'keyId="' To iSuccess // Use your identifier for the application's signature certificate, obtained from the Developer Portal Get ComAppend Of hoSbSigHeaderValue "a0ce296d-84c8-4bd5-8eb4-de0339950cfa" To iSuccess Get ComAppend Of hoSbSigHeaderValue '",created=' To iSuccess Get ComAppend Of hoSbSigHeaderValue sCreated To iSuccess Get ComAppend Of hoSbSigHeaderValue ',algorithm="hs2019",headers="' To iSuccess Get ComAppend Of hoSbSigHeaderValue sSigned_headers_list To iSuccess Get ComAppend Of hoSbSigHeaderValue '",signature="' To iSuccess Get ComAppend Of hoSbSigHeaderValue sSigBase64 To iSuccess Get ComAppend Of hoSbSigHeaderValue '"' To iSuccess // Send the GET request.. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Get pvComObject of hoCert to vCert Get ComSetSslClientCert Of hoHttp vCert To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComGetAsString Of hoSbSigHeaderValue To sTemp1 Send ComSetRequestHeader To hoHttp "Signature" sTemp1 Get ComGetAsString Of hoSbDigestHdrValue To sTemp1 Send ComSetRequestHeader To hoHttp "Digest" sTemp1 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.ibanity.com/xs2a/financial-institutions" 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 output: // (Sample code for parsing the JSON response is shown below) // { // "data": [ // { // "attributes": { // "authorizationModels": [ // "detailed", // "financialInstitutionOffered" // ], // "bic": "NBBEBEBB203", // "bulkPaymentsEnabled": true, // "bulkPaymentsProductTypes": [ // "sepaCreditTransfer" // ], // "country": null, // "financialInstitutionCustomerReferenceRequired": false, // "futureDatedPaymentsAllowed": true, // "logoUrl": "https://s3.eu-central-1.amazonaws.com/ibanity-production-financial-institution-assets/sandbox.png", // "maintenanceFrom": null, // "maintenanceTo": null, // "maintenanceType": null, // "maxRequestedAccountReferences": null, // "minRequestedAccountReferences": 0, // "name": "Bogus Financial", // "paymentsEnabled": true, // "paymentsProductTypes": [ // "sepaCreditTransfer" // ], // "periodicPaymentsEnabled": true, // "periodicPaymentsProductTypes": [ // "sepaCreditTransfer" // ], // "primaryColor": "#7d39ff", // "requiresCredentialStorage": false, // "requiresCustomerIpAddress": false, // "sandbox": true, // "secondaryColor": "#3DF2C2", // "sharedBrandName": null, // "sharedBrandReference": null, // "status": "beta" // }, // "id": "2d3d70a4-cb3c-477c-97e1-cbe495b82841", // "links": { // "self": "https://api.ibanity.com/xs2a/financial-institutions/2d3d70a4-cb3c-477c-97e1-cbe495b82841" // }, // "type": "financialInstitution" // }, // { // "attributes": { // "authorizationModels": [ // "detailed", // "financialInstitutionOffered" // ], // "bic": "NBBEBEBB203", // "bulkPaymentsEnabled": true, // "bulkPaymentsProductTypes": [ // "sepaCreditTransfer" // ], // "country": null, // "financialInstitutionCustomerReferenceRequired": false, // "futureDatedPaymentsAllowed": true, // "logoUrl": "https://s3.eu-central-1.amazonaws.com/ibanity-production-financial-institution-assets/sandbox.png", // "maintenanceFrom": null, // "maintenanceTo": null, // "maintenanceType": null, // "maxRequestedAccountReferences": null, // "minRequestedAccountReferences": 0, // "name": "XYZ Trust", // "paymentsEnabled": true, // "paymentsProductTypes": [ // "sepaCreditTransfer" // ], // "periodicPaymentsEnabled": true, // "periodicPaymentsProductTypes": [ // "sepaCreditTransfer" // ], // "primaryColor": "#7d39ff", // "requiresCredentialStorage": false, // "requiresCustomerIpAddress": false, // "sandbox": true, // "secondaryColor": "#3DF2C2", // "sharedBrandName": null, // "sharedBrandReference": null, // "status": "beta" // }, // "id": "d4100f28-936b-4379-a3f8-86314a2014fb", // "links": { // "self": "https://api.ibanity.com/xs2a/financial-institutions/d4100f28-936b-4379-a3f8-86314a2014fb" // }, // "type": "financialInstitution" // } // ], // "links": { // "first": "https://api.ibanity.com/xs2a/financial-institutions" // }, // "meta": { // "paging": { // "limit": 10 // } // } // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON Get ComStringOf Of hoJResp "links.first" To sLinksFirst Get ComIntOf Of hoJResp "meta.paging.limit" To iMetaPagingLimit Move 0 To i Get ComSizeOfArray Of hoJResp "data" To iCount_i While (i < iCount_i) Set ComI Of hoJResp To i Get ComStringOf Of hoJResp "data[i].attributes.bic" To sAttributesBic Get ComBoolOf Of hoJResp "data[i].attributes.bulkPaymentsEnabled" To iAttributesBulkPaymentsEnabled Get ComStringOf Of hoJResp "data[i].attributes.country" To sAttributesCountry Get ComBoolOf Of hoJResp "data[i].attributes.financialInstitutionCustomerReferenceRequired" To iAttributesFinancialInstitutionCustomerReferenceRequired Get ComBoolOf Of hoJResp "data[i].attributes.futureDatedPaymentsAllowed" To iAttributesFutureDatedPaymentsAllowed Get ComStringOf Of hoJResp "data[i].attributes.logoUrl" To sAttributesLogoUrl Get ComStringOf Of hoJResp "data[i].attributes.maintenanceFrom" To sAttributesMaintenanceFrom Get ComStringOf Of hoJResp "data[i].attributes.maintenanceTo" To sAttributesMaintenanceTo Get ComStringOf Of hoJResp "data[i].attributes.maintenanceType" To sAttributesMaintenanceType Get ComStringOf Of hoJResp "data[i].attributes.maxRequestedAccountReferences" To sAttributesMaxRequestedAccountReferences Get ComIntOf Of hoJResp "data[i].attributes.minRequestedAccountReferences" To iAttributesMinRequestedAccountReferences Get ComStringOf Of hoJResp "data[i].attributes.name" To sAttributesName Get ComBoolOf Of hoJResp "data[i].attributes.paymentsEnabled" To iAttributesPaymentsEnabled Get ComBoolOf Of hoJResp "data[i].attributes.periodicPaymentsEnabled" To iAttributesPeriodicPaymentsEnabled Get ComStringOf Of hoJResp "data[i].attributes.primaryColor" To sAttributesPrimaryColor Get ComBoolOf Of hoJResp "data[i].attributes.requiresCredentialStorage" To iAttributesRequiresCredentialStorage Get ComBoolOf Of hoJResp "data[i].attributes.requiresCustomerIpAddress" To iAttributesRequiresCustomerIpAddress Get ComBoolOf Of hoJResp "data[i].attributes.sandbox" To iAttributesSandbox Get ComStringOf Of hoJResp "data[i].attributes.secondaryColor" To sAttributesSecondaryColor Get ComStringOf Of hoJResp "data[i].attributes.sharedBrandName" To sAttributesSharedBrandName Get ComStringOf Of hoJResp "data[i].attributes.sharedBrandReference" To sAttributesSharedBrandReference Get ComStringOf Of hoJResp "data[i].attributes.status" To sAttributesStatus Get ComStringOf Of hoJResp "data[i].id" To sId Get ComStringOf Of hoJResp "data[i].links.self" To sLinksSelf Get ComStringOf Of hoJResp "data[i].type" To sV_type Move 0 To j Get ComSizeOfArray Of hoJResp "data[i].attributes.authorizationModels" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Get ComStringOf Of hoJResp "data[i].attributes.authorizationModels[j]" To sStrVal Move (j + 1) To j Loop Move 0 To j Get ComSizeOfArray Of hoJResp "data[i].attributes.bulkPaymentsProductTypes" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Get ComStringOf Of hoJResp "data[i].attributes.bulkPaymentsProductTypes[j]" To sStrVal Move (j + 1) To j Loop Move 0 To j Get ComSizeOfArray Of hoJResp "data[i].attributes.paymentsProductTypes" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Get ComStringOf Of hoJResp "data[i].attributes.paymentsProductTypes[j]" To sStrVal Move (j + 1) To j Loop Move 0 To j Get ComSizeOfArray Of hoJResp "data[i].attributes.periodicPaymentsProductTypes" To iCount_j While (j < iCount_j) Set ComJ Of hoJResp To j Get ComStringOf Of hoJResp "data[i].attributes.periodicPaymentsProductTypes[j]" To sStrVal Move (j + 1) To j Loop Move (i + 1) To i Loop End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.