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
(Swift 3,4,5...) Shopware List CategoriesSee more Shopware ExamplesList categories in your Shopware database. For more information, see https://developers.shopware.com/developers-guide/rest-api/api-resource-categories/
func chilkatTest() { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. let http = CkoHttp()! http.login = "api_username" http.password = "api_key" http.basicAuth = true let sbResponseBody = CkoStringBuilder()! var success: Bool = http.quickGetSb("https://my-shopware-shop.com/api/categories?limit=2", sbContent: sbResponseBody) if success == false { print("\(http.lastErrorText!)") return } let jResp = CkoJsonObject()! jResp.loadSb(sbResponseBody) jResp.emitCompact = false print("Response Body:") print("\(jResp.emit()!)") // Sample JSON response: // (Sample code for parsing the JSON response is shown below) // { // "data": [ // { // "id": 1, // "active": true, // "name": "Root", // "position": 0, // "parentId": null, // "mediaId": null, // "childrenCount": "3", // "articleCount": "0" // }, // { // "id": 384, // "active": true, // "name": "Deutsch", // "position": 0, // "parentId": 1, // "mediaId": null, // "childrenCount": "9", // "articleCount": "32" // } // ], // "total": 118, // "success": true // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON var id: Int var active: Bool var name: String? var position: Int var parentId: String? var mediaId: String? var childrenCount: String? var articleCount: String? var total: Int = jResp.int(of: "total").intValue var success: Bool = jResp.bool(of: "success") var i: Int = 0 var count_i: Int = jResp.size(ofArray: "data").intValue while i < count_i { jResp.i = i id = jResp.int(of: "data[i].id").intValue active = jResp.bool(of: "data[i].active") name = jResp.string(of: "data[i].name") position = jResp.int(of: "data[i].position").intValue parentId = jResp.string(of: "data[i].parentId") mediaId = jResp.string(of: "data[i].mediaId") childrenCount = jResp.string(of: "data[i].childrenCount") articleCount = jResp.string(of: "data[i].articleCount") i = i + 1 } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.