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
(PureBasic) Yapily - Get Application SelfSee more Yapily ExamplesGet the information about the institutions configured in your application For more information, see https://docs.yapily.com/api/reference/#operation/getApplicationMe
IncludeFile "CkHttp.pb" IncludeFile "CkStringBuilder.pb" IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i ; 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::setCkLogin(http, "<username>") CkHttp::setCkPassword(http, "<password>") sbResponseBody.i = CkStringBuilder::ckCreate() If sbResponseBody.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkHttp::ckQuickGetSb(http,"https://api.yapily.com/me",sbResponseBody) If success = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkStringBuilder::ckDispose(sbResponseBody) ProcedureReturn EndIf jResp.i = CkJsonObject::ckCreate() If jResp.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckLoadSb(jResp,sbResponseBody) CkJsonObject::setCkEmitCompact(jResp, 0) Debug "Response Body:" Debug CkJsonObject::ckEmit(jResp) respStatusCode.i = CkHttp::ckLastStatus(http) Debug "Response Status Code = " + Str(respStatusCode) If respStatusCode >= 400 Debug "Response Header:" Debug CkHttp::ckLastHeader(http) Debug "Failed." CkHttp::ckDispose(http) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn EndIf ; 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 strVal.s id.s fullName.s environmentType.s credentialsType.s j.i count_j.i displayName.s countryCode2.s source.s v_type.s uuid.s = CkJsonObject::ckStringOf(jResp,"uuid") name.s = CkJsonObject::ckStringOf(jResp,"name") active.i = CkJsonObject::ckBoolOf(jResp,"active") created.s = CkJsonObject::ckStringOf(jResp,"created") updated.s = CkJsonObject::ckStringOf(jResp,"updated") i.i = 0 count_i.i = CkJsonObject::ckSizeOfArray(jResp,"authCallbacks") While i < count_i CkJsonObject::setCkI(jResp, i) strVal = CkJsonObject::ckStringOf(jResp,"authCallbacks[i]") i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jResp,"institutions") While i < count_i CkJsonObject::setCkI(jResp, i) id = CkJsonObject::ckStringOf(jResp,"institutions[i].id") name = CkJsonObject::ckStringOf(jResp,"institutions[i].name") fullName = CkJsonObject::ckStringOf(jResp,"institutions[i].fullName") environmentType = CkJsonObject::ckStringOf(jResp,"institutions[i].environmentType") credentialsType = CkJsonObject::ckStringOf(jResp,"institutions[i].credentialsType") j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"institutions[i].countries") While j < count_j CkJsonObject::setCkJ(jResp, j) displayName = CkJsonObject::ckStringOf(jResp,"institutions[i].countries[j].displayName") countryCode2 = CkJsonObject::ckStringOf(jResp,"institutions[i].countries[j].countryCode2") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"institutions[i].media") While j < count_j CkJsonObject::setCkJ(jResp, j) source = CkJsonObject::ckStringOf(jResp,"institutions[i].media[j].source") v_type = CkJsonObject::ckStringOf(jResp,"institutions[i].media[j].type") j = j + 1 Wend j = 0 count_j = CkJsonObject::ckSizeOfArray(jResp,"institutions[i].features") While j < count_j CkJsonObject::setCkJ(jResp, j) strVal = CkJsonObject::ckStringOf(jResp,"institutions[i].features[j]") j = j + 1 Wend i = i + 1 Wend i = 0 count_i = CkJsonObject::ckSizeOfArray(jResp,"media") While i < count_i CkJsonObject::setCkI(jResp, i) i = i + 1 Wend CkHttp::ckDispose(http) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.