![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Datev - Get a List of ClientsSee more Datev ExamplesDemonstrates how to get a list of clients in the accounting:clients Datev API.Note: This example requires Chilkat v10.1.3 or greater. For more information, see https://developer.datev.de/en/product-detail/accounting-clients/2.0/reference/reference-api-overview/accountingclients/clients-get
integer li_rc oleobject loo_Http integer li_Success oleobject loo_QueryParams oleobject loo_Resp oleobject loo_Jarr oleobject loo_Json integer li_Client_number integer li_Consultant_number string ls_Id string ls_Name integer j integer li_Count_j integer k integer li_Count_k string ls_StrVal integer i integer li_Count_i 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://accounting-clients.api.datev.de/platform/v2/clients?filter=REPLACE_THIS_VALUE&skip=REPLACE_THIS_VALUE&top=REPLACE_THIS_VALUE" \ // --header "Authorization: Bearer REPLACE_BEARER_TOKEN" \ // --header "X-Datev-Client-ID: clientId" \ // --header "accept: application/json;charset=utf-8" // Use the following online tool to generate HTTP code from a CURL command // Convert a cURL Command to HTTP Source Code loo_QueryParams = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject") // ignore = queryParams.UpdateString("filter","REPLACE_THIS_VALUE"); // ignore = queryParams.UpdateString("skip","REPLACE_THIS_VALUE"); // ignore = queryParams.UpdateString("top","REPLACE_THIS_VALUE"); // Adds the "Authorization: Bearer REPLACE_BEARER_TOKEN" header. loo_Http.AuthToken = "REPLACE_BEARER_TOKEN" loo_Http.SetRequestHeader("accept","application/json;charset=utf-8") loo_Http.SetRequestHeader("X-Datev-Client-ID","DATEV_CLIENT_ID") loo_Resp = loo_Http.QuickRequestParams("GET","https://accounting-clients.api.datev.de/platform-sandbox/v2/clients",loo_QueryParams) if loo_Http.LastMethodSuccess = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_QueryParams return end if Write-Debug string(loo_Resp.StatusCode) Write-Debug loo_Resp.BodyStr loo_Jarr = create oleobject // Use "Chilkat_9_5_0.JsonArray" for versions of Chilkat < 10.0.0 li_rc = loo_Jarr.ConnectToNewObject("Chilkat.JsonArray") // Insert code here to load the above JSON array into the jarr object. loo_Jarr.Load(loo_Resp.BodyStr) destroy loo_Resp i = 0 li_Count_i = loo_Jarr.Size do while i < li_Count_i loo_Json = loo_Jarr.ObjectAt(i) li_Client_number = loo_Json.IntOf("client_number") li_Consultant_number = loo_Json.IntOf("consultant_number") ls_Id = loo_Json.StringOf("id") ls_Name = loo_Json.StringOf("name") j = 0 li_Count_j = loo_Json.SizeOfArray("services") do while j < li_Count_j loo_Json.J = j ls_Name = loo_Json.StringOf("services[j].name") k = 0 li_Count_k = loo_Json.SizeOfArray("services[j].scopes") do while k < li_Count_k loo_Json.K = k ls_StrVal = loo_Json.StringOf("services[j].scopes[k]") k = k + 1 loop j = j + 1 loop destroy loo_Json i = i + 1 loop destroy loo_Http destroy loo_QueryParams destroy loo_Jarr |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.