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
(PowerBuilder) MYOB: Get List of Company FilesGets a list of company files. For more information, see https://developer.myob.com/api/accountright/v2/company-files/
integer li_rc oleobject loo_Http string ls_StrResp oleobject loo_JsonResponse string ls_Id string ls_Name string ls_LibraryPath string ls_ProductVersion integer li_ProductLevelCode string ls_ProductLevelName string ls_CheckedOutDate string ls_CheckedOutBy string ls_Uri string ls_Country // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. 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 loo_Http.AuthToken = "ACCESS_TOKEN" loo_Http.Accept = "application/json" loo_Http.SetRequestHeader("x-myobapi-key","MYOB_API_KEY") loo_Http.SetRequestHeader("x-myobapi-version","v2") ls_StrResp = loo_Http.QuickGetStr("https://ar1.api.myob.com/accountright") if loo_Http.LastMethodSuccess <> 1 then Write-Debug loo_Http.LastErrorText destroy loo_Http return end if Write-Debug "Response Status Code: " + string(loo_Http.LastStatus) loo_JsonResponse = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JsonResponse.ConnectToNewObject("Chilkat.JsonObject") loo_JsonResponse.Load(ls_StrResp) loo_JsonResponse.EmitCompact = 0 Write-Debug loo_JsonResponse.Emit() if loo_Http.LastStatus <> 200 then Write-Debug "Failed." destroy loo_Http destroy loo_JsonResponse return end if // Sample output... // (See the parsing code below..) // // Use the this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON // { // "Id": "d2014f64-ffdf-487b-8d12-67a20976aca6", // "Name": "Internal Sandbox API", // "LibraryPath": "Internal Sandbox API", // "ProductVersion": "2013.0", // "ProductLevel": { // "Code": 20, // "Name": "Standard" // }, // "CheckedOutDate": "2013-06-11T01:47:47.0065514", // "CheckedOutBy": "developers@myob.com", // "Uri": "{cf_uri}", // "Country": "AU" // } // ls_Id = loo_JsonResponse.StringOf("Id") ls_Name = loo_JsonResponse.StringOf("Name") ls_LibraryPath = loo_JsonResponse.StringOf("LibraryPath") ls_ProductVersion = loo_JsonResponse.StringOf("ProductVersion") li_ProductLevelCode = loo_JsonResponse.IntOf("ProductLevel.Code") ls_ProductLevelName = loo_JsonResponse.StringOf("ProductLevel.Name") ls_CheckedOutDate = loo_JsonResponse.StringOf("CheckedOutDate") ls_CheckedOutBy = loo_JsonResponse.StringOf("CheckedOutBy") ls_Uri = loo_JsonResponse.StringOf("Uri") ls_Country = loo_JsonResponse.StringOf("Country") destroy loo_Http destroy loo_JsonResponse |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.