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
(Unicode C) Isabel Connect List TransactionsSee more Ibanity ExamplesGet a list of transactions for an account. For more information, see https://documentation.ibanity.com/isabel-connect/api#list-accounts
#include <C_CkHttpW.h> #include <C_CkJsonObjectW.h> void ChilkatSample(void) { HCkHttpW http; BOOL success; HCkJsonObjectW jsonToken; const wchar_t *jsonStr; HCkJsonObjectW jResp; int respStatusCode; int attributesAmount; const wchar_t *attributesCounterpartAccountReference; const wchar_t *attributesCounterpartFinancialInstitutionBic; const wchar_t *attributesCounterpartName; const wchar_t *attributesEndToEndId; const wchar_t *attributesExecutionDate; const wchar_t *attributesInternalId; const wchar_t *attributesRemittanceInformation; const wchar_t *attributesRemittanceInformationType; const wchar_t *attributesStatus; const wchar_t *attributesValueDate; const wchar_t *id; const wchar_t *v_type; int metaPagingOffset; int metaPagingTotal; int i; int count_i; // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttpW_Create(); // Implements the following CURL command: // curl -X GET https://api.ibanity.com/isabel-connect/accounts/93ecb1fdbfb7848e7b7896c0f2d207aed3d8b4c1/transactions \ // --cert certificate.pem:qwertyuiop1 \ // --key private_key.pem \ // -H "Authorization: Bearer access_token_1603365408" \ // -H "Accept: application/vnd.api+json" // 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.) success = CkHttpW_SetSslClientCertPfx(http,L"qa_data/pfx/my_ibanity_certificate.pfx",L"my_pfx_password"); if (success == FALSE) { wprintf(L"%s\n",CkHttpW_lastErrorText(http)); CkHttpW_Dispose(http); return; } // Load the previously obtained access token. jsonToken = CkJsonObjectW_Create(); success = CkJsonObjectW_LoadFile(jsonToken,L"qa_data/tokens/isabel_access_token.json"); if (success == FALSE) { wprintf(L"No existing access token.\n"); CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonToken); return; } // This causes the "Authorization: Bearer ***" header to be added to the HTTP request. CkHttpW_putAuthToken(http,CkJsonObjectW_stringOf(jsonToken,L"access_token")); CkHttpW_putAccept(http,L"application/vnd.api+json"); CkHttpW_SetUrlVar(http,L"id",L"93ecb1fdbfb7848e7b7896c0f2d207aed3d8b4c1"); jsonStr = CkHttpW_quickGetStr(http,L"https://api.ibanity.com/isabel-connect/accounts/{$id}/transactions"); if (CkHttpW_getLastMethodSuccess(http) == FALSE) { wprintf(L"%s\n",CkHttpW_lastErrorText(http)); CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonToken); return; } jResp = CkJsonObjectW_Create(); CkJsonObjectW_Load(jResp,jsonStr); CkJsonObjectW_putEmitCompact(jResp,FALSE); wprintf(L"Response Body:\n"); wprintf(L"%s\n",CkJsonObjectW_emit(jResp)); respStatusCode = CkHttpW_getLastStatus(http); wprintf(L"Response Status Code = %d\n",respStatusCode); if (respStatusCode >= 400) { wprintf(L"Response Header:\n"); wprintf(L"%s\n",CkHttpW_lastResponseHeader(http)); wprintf(L"Failed.\n"); CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonToken); CkJsonObjectW_Dispose(jResp); return; } // Sample JSON response: // (Sample code for parsing the JSON response is shown below) // { // "data": [ // { // "attributes": { // "amount": 80000, // "counterpartAccountReference": "BE21210123456703", // "counterpartFinancialInstitutionBic": "GEBABEBB", // "counterpartName": "MYBESTCLIENT", // "endToEndId": "UNIQUE CODE CUSTOMER", // "executionDate": "2018-10-15T08:34:17.417Z", // "internalId": "UNIQUE CODE BANK", // "remittanceInformation": "123456789002", // "remittanceInformationType": "structured-be", // "status": "Booked", // "valueDate": "2018-10-15T08:52:43.962Z" // }, // "id": "14e2bff5-e365-4bc7-bf48-76b7bcd464e9", // "type": "transaction" // }, // { // "attributes": { // "amount": 40000, // "counterpartAccountReference": "BE58400101010179", // "counterpartFinancialInstitutionBic": "KREDBEBB", // "counterpartName": "MYGOODCLIENT", // "endToEndId": null, // "executionDate": "2018-10-15T08:34:17.417Z", // "internalId": null, // "remittanceInformation": "FREE COMMUNICATION", // "remittanceInformationType": "unstructured", // "status": "Booked", // "valueDate": "2018-10-15T08:52:43.962Z" // }, // "id": "29b0f52e-a389-4ff8-88e1-cc30c12b789f", // "type": "transaction" // }, // { // "attributes": { // "amount": -20000, // "counterpartAccountReference": "BE56300694353788", // "counterpartFinancialInstitutionBic": null, // "counterpartName": "MY SUPPLIER", // "endToEndId": null, // "executionDate": "2018-10-15T08:34:17.417Z", // "internalId": null, // "remittanceInformation": "999000000171", // "remittanceInformationType": "structured-be", // "status": "Booked", // "valueDate": "2018-10-15T08:52:43.962Z" // }, // "id": "7d79a28e-b45d-4595-b98e-7c18871ee208", // "type": "transaction" // } // ], // "meta": { // "paging": { // "offset": 0, // "total": 3 // } // } // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat. // See this example explaining how this memory should be used: const char * functions. metaPagingOffset = CkJsonObjectW_IntOf(jResp,L"meta.paging.offset"); metaPagingTotal = CkJsonObjectW_IntOf(jResp,L"meta.paging.total"); i = 0; count_i = CkJsonObjectW_SizeOfArray(jResp,L"data"); while (i < count_i) { CkJsonObjectW_putI(jResp,i); attributesAmount = CkJsonObjectW_IntOf(jResp,L"data[i].attributes.amount"); attributesCounterpartAccountReference = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.counterpartAccountReference"); attributesCounterpartFinancialInstitutionBic = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.counterpartFinancialInstitutionBic"); attributesCounterpartName = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.counterpartName"); attributesEndToEndId = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.endToEndId"); attributesExecutionDate = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.executionDate"); attributesInternalId = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.internalId"); attributesRemittanceInformation = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.remittanceInformation"); attributesRemittanceInformationType = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.remittanceInformationType"); attributesStatus = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.status"); attributesValueDate = CkJsonObjectW_stringOf(jResp,L"data[i].attributes.valueDate"); id = CkJsonObjectW_stringOf(jResp,L"data[i].id"); v_type = CkJsonObjectW_stringOf(jResp,L"data[i].type"); i = i + 1; } CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonToken); CkJsonObjectW_Dispose(jResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.