Delphi DLL
Delphi DLL
Yapily - Get Application Self
See more Yapily Examples
Get the information about the institutions configured in your applicationChilkat Delphi DLL Downloads
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http, StringBuilder, JsonObject;
...
procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
http: HCkHttp;
sbResponseBody: HCkStringBuilder;
jResp: HCkJsonObject;
respStatusCode: Integer;
strVal: PWideChar;
id: PWideChar;
fullName: PWideChar;
environmentType: PWideChar;
credentialsType: PWideChar;
j: Integer;
count_j: Integer;
displayName: PWideChar;
countryCode2: PWideChar;
source: PWideChar;
v_type: PWideChar;
uuid: PWideChar;
name: PWideChar;
active: Boolean;
created: PWideChar;
updated: PWideChar;
i: Integer;
count_i: Integer;
begin
success := False;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := CkHttp_Create();
// Implements the following CURL command:
// curl -i -X GET \
// -u <username>:<password> \
// https://api.yapily.com/me
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
CkHttp_putLogin(http,'<username>');
CkHttp_putPassword(http,'<password>');
sbResponseBody := CkStringBuilder_Create();
success := CkHttp_QuickGetSb(http,'https://api.yapily.com/me',sbResponseBody);
if (success = False) then
begin
Memo1.Lines.Add(CkHttp__lastErrorText(http));
Exit;
end;
jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,False);
Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkJsonObject__emit(jResp));
respStatusCode := CkHttp_getLastStatus(http);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode >= 400) then
begin
Memo1.Lines.Add('Response Header:');
Memo1.Lines.Add(CkHttp__lastHeader(http));
Memo1.Lines.Add('Failed.');
Exit;
end;
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "uuid": "64949de6-6510-4d70-9500-d4aa094c506c",
// "name": "APPLICATION NAME",
// "active": true,
// "authCallbacks": [
// "https://display-parameters.com/"
// ],
// "institutions": [
// {
// "id": "modelo-sandbox",
// "name": "Modelo Sandbox",
// "fullName": "Modelo Sandbox",
// "countries": [
// {
// "displayName": "United Kingdom",
// "countryCode2": "GB"
// }
// ],
// "environmentType": "SANDBOX",
// "credentialsType": "OPEN_BANKING_UK_AUTO",
// "media": [
// {
// "source": "https://images.yapily.com/image/ce2bfdbf-1ae2-4919-ab7b-e8b3d5e93b36?size=0",
// "type": "icon"
// },
// {
// "source": "https://images.yapily.com/image/ca502f24-d6df-4785-b4b8-1034b100af77?size=0",
// "type": "logo"
// }
// ],
// "features": [
// "INITIATE_SINGLE_PAYMENT_SORTCODE",
// "CREATE_DOMESTIC_PERIODIC_PAYMENT",
// "ACCOUNT_REQUEST_DETAILS",
// "ACCOUNT_STATEMENT_FILE",
// "CREATE_SINGLE_PAYMENT_SORTCODE",
// "ACCOUNTS",
// "CREATE_DOMESTIC_SCHEDULED_PAYMENT",
// "ACCOUNT_PERIODIC_PAYMENTS",
// "CREATE_DOMESTIC_SINGLE_PAYMENT",
// "INITIATE_DOMESTIC_PERIODIC_PAYMENT",
// "EXISTING_PAYMENTS_DETAILS",
// "INITIATE_BULK_PAYMENT",
// "EXISTING_PAYMENT_INITIATION_DETAILS",
// "ACCOUNT_DIRECT_DEBITS",
// "ACCOUNT_TRANSACTIONS",
// "INITIATE_DOMESTIC_SINGLE_PAYMENT",
// "PERIODIC_PAYMENT_FREQUENCY_EXTENDED",
// "CREATE_INTERNATIONAL_SINGLE_PAYMENT",
// "ACCOUNT_SCHEDULED_PAYMENTS",
// "ACCOUNT",
// "ACCOUNT_STATEMENTS",
// "ACCOUNT_TRANSACTIONS_WITH_MERCHANT",
// "CREATE_BULK_PAYMENT",
// "ACCOUNT_BALANCES",
// "INITIATE_INTERNATIONAL_SINGLE_PAYMENT",
// "INITIATE_DOMESTIC_SCHEDULED_PAYMENT",
// "ACCOUNT_BENEFICIARIES",
// "IDENTITY",
// "ACCOUNT_STATEMENT",
// "INITIATE_ACCOUNT_REQUEST"
// ]
// }
// ],
// "media": [
// ],
// "created": "2020-11-09T10:05:29.897+0000",
// "updated": "2021-04-14T12:51:07.419+0000"
// }
// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
uuid := CkJsonObject__stringOf(jResp,'uuid');
name := CkJsonObject__stringOf(jResp,'name');
active := CkJsonObject_BoolOf(jResp,'active');
created := CkJsonObject__stringOf(jResp,'created');
updated := CkJsonObject__stringOf(jResp,'updated');
i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'authCallbacks');
while i < count_i do
begin
CkJsonObject_putI(jResp,i);
strVal := CkJsonObject__stringOf(jResp,'authCallbacks[i]');
i := i + 1;
end;
i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'institutions');
while i < count_i do
begin
CkJsonObject_putI(jResp,i);
id := CkJsonObject__stringOf(jResp,'institutions[i].id');
name := CkJsonObject__stringOf(jResp,'institutions[i].name');
fullName := CkJsonObject__stringOf(jResp,'institutions[i].fullName');
environmentType := CkJsonObject__stringOf(jResp,'institutions[i].environmentType');
credentialsType := CkJsonObject__stringOf(jResp,'institutions[i].credentialsType');
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'institutions[i].countries');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
displayName := CkJsonObject__stringOf(jResp,'institutions[i].countries[j].displayName');
countryCode2 := CkJsonObject__stringOf(jResp,'institutions[i].countries[j].countryCode2');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'institutions[i].media');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
source := CkJsonObject__stringOf(jResp,'institutions[i].media[j].source');
v_type := CkJsonObject__stringOf(jResp,'institutions[i].media[j].type');
j := j + 1;
end;
j := 0;
count_j := CkJsonObject_SizeOfArray(jResp,'institutions[i].features');
while j < count_j do
begin
CkJsonObject_putJ(jResp,j);
strVal := CkJsonObject__stringOf(jResp,'institutions[i].features[j]');
j := j + 1;
end;
i := i + 1;
end;
i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'media');
while i < count_i do
begin
CkJsonObject_putI(jResp,i);
i := i + 1;
end;
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
end;