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) Bunny Edge Storage - List FilesSee more Bunny CDN ExamplesRetrieve a list of files and directories located in the given directory. For more information, see https://docs.bunny.net/reference/get_-storagezonename-path-
integer li_rc oleobject loo_Http integer li_Success oleobject loo_SbResponse integer li_StatusCode oleobject loo_Jarr oleobject loo_Json string ls_Guid string ls_StorageZoneName string ls_Path string ls_ObjectName integer li_Length string ls_LastChanged integer li_ServerId integer li_ArrayNumber integer li_IsDirectory string ls_UserId string ls_ContentType string ls_DateCreated integer li_StorageZoneId string ls_Checksum string ls_ReplicatedZones integer i integer li_Count_i // This example assumes 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 // Use the "Password" from the "FTP & HTTP API Access" console web page for your Bunny storage zone. loo_Http.SetRequestHeader("AccessKey","YOUR_FTP_AND_HTTP_PASSWORD") // Storage Endpoints: // The storage API endpoint depends on the primary storage region of your storage zone. You can also find this in the FTP & HTTP API Information of your storage zone. // Falkenstein: storage.bunnycdn.com // New York: ny.storage.bunnycdn.com // Los Angeles: la.storage.bunnycdn.com // Singapore: sg.storage.bunnycdn.com // Sydney: syd.storage.bunnycdn.com // London: uk.storage.bunnycdn.com // ... (possibly others??) loo_SbResponse = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbResponse.ConnectToNewObject("Chilkat.StringBuilder") // Change the "storageZoneName" to your actual storage zone name. li_Success = loo_Http.QuickGetSb("https://uk.storage.bunnycdn.com/storageZoneName/testDir/",loo_SbResponse) if li_Success = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_SbResponse return end if li_StatusCode = loo_Http.LastStatus Write-Debug "Status code = " + string(li_StatusCode) if li_StatusCode <> 200 then Write-Debug loo_SbResponse.GetAsString() Write-Debug "Failed." destroy loo_Http destroy loo_SbResponse return end if loo_Jarr = create oleobject // Use "Chilkat_9_5_0.JsonArray" for versions of Chilkat < 10.0.0 li_rc = loo_Jarr.ConnectToNewObject("Chilkat.JsonArray") loo_Jarr.LoadSb(loo_SbResponse) loo_Jarr.EmitCompact = 0 Write-Debug loo_Jarr.Emit() // Here is a sample response. Parsing code is shown below.. // [ // { // "Guid": "ebd9ccff-faf7-449d-9c71-8662b9f3cf41", // "StorageZoneName": "chilkat", // "Path": "/chilkat/testDir/", // "ObjectName": "seahorse.jpg", // "Length": 24388, // "LastChanged": "2023-04-21T15:59:08.382", // "ServerId": 586, // "ArrayNumber": 0, // "IsDirectory": false, // "UserId": "6d26ab35-2914-422c-9378-d51f38166e53", // "ContentType": "", // "DateCreated": "2023-04-21T15:59:08.382", // "StorageZoneId": 266805, // "Checksum": "0503558E7B4D141C067BEECFD06F87F6F58B81E37918310F82C7C4077D27BD1D", // "ReplicatedZones": "SE,DE,LA,SG,JH,BR,SYD,NY" // }, // { // "Guid": "e74b85f8-4d5d-459e-a2fc-0fcfa8c926aa", // "StorageZoneName": "chilkat", // "Path": "/chilkat/testDir/", // "ObjectName": "seal.jpg", // "Length": 342708, // "LastChanged": "2023-04-21T15:59:08.763", // "ServerId": 586, // "ArrayNumber": 2, // "IsDirectory": false, // "UserId": "6d26ab35-2914-422c-9378-d51f38166e53", // "ContentType": "", // "DateCreated": "2023-04-21T15:59:08.763", // "StorageZoneId": 266805, // "Checksum": "C95F946A0299CE39C20A072B3DC581446B2EE2D94CA93901B58604F4EFB8AAB5", // "ReplicatedZones": "DE,SE,SG,LA,JH,BR,SYD,NY" // }, // { // "Guid": "ca80cdbd-c6cf-445d-b367-0b33de7ae65a", // "StorageZoneName": "chilkat", // "Path": "/chilkat/testDir/", // "ObjectName": "university.jpg", // "Length": 277581, // "LastChanged": "2023-04-21T15:59:10.142", // "ServerId": 586, // "ArrayNumber": 0, // "IsDirectory": false, // "UserId": "6d26ab35-2914-422c-9378-d51f38166e53", // "ContentType": "", // "DateCreated": "2023-04-21T15:59:10.142", // "StorageZoneId": 266805, // "Checksum": "96A10EAA1B778C066739A6233206022DB219B67A8775401D7865F40E6DD83571", // "ReplicatedZones": "DE,SE,SG,JH,BR,LA,SYD,NY" // } // ] // Use this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON i = 0 li_Count_i = loo_Jarr.Size do while i < li_Count_i loo_Json = loo_Jarr.ObjectAt(i) ls_Guid = loo_Json.StringOf("Guid") ls_StorageZoneName = loo_Json.StringOf("StorageZoneName") ls_Path = loo_Json.StringOf("Path") ls_ObjectName = loo_Json.StringOf("ObjectName") li_Length = loo_Json.IntOf("Length") ls_LastChanged = loo_Json.StringOf("LastChanged") li_ServerId = loo_Json.IntOf("ServerId") li_ArrayNumber = loo_Json.IntOf("ArrayNumber") li_IsDirectory = loo_Json.BoolOf("IsDirectory") ls_UserId = loo_Json.StringOf("UserId") ls_ContentType = loo_Json.StringOf("ContentType") ls_DateCreated = loo_Json.StringOf("DateCreated") li_StorageZoneId = loo_Json.IntOf("StorageZoneId") ls_Checksum = loo_Json.StringOf("Checksum") ls_ReplicatedZones = loo_Json.StringOf("ReplicatedZones") destroy loo_Json i = i + 1 loop destroy loo_Http destroy loo_SbResponse destroy loo_Jarr |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.