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 ArticlesSee more Shopware ExamplesThis example shows you how to obtain information about a Shopware product list. With the optional limit parameter, it's possible to specify how many products you wish the API call to return. For more information, see https://developers.shopware.com/developers-guide/rest-api/examples/article/
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/articles?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": 8283, // "mainDetailId": 11398, // "supplierId": 28, // "taxId": 1, // "priceGroupId": 1, // "filterGroupId": null, // "configuratorSetId": null, // "name": "TERRA PC-GAMER 8000 iQ9650 VU - \u00e5\u00a0 \u00c7 Produktmer", // "description": "TERRA PC-GAMER 8000 iQ9650 VU - \u00e5\u00a0 \u00c7 Produktmer", // "descriptionLong": "...", // "added": "2000-01-01T00:00:00+0100", // "active": true, // "pseudoSales": 0, // "highlight": false, // "keywords": null, // "metaTitle": "TERRA PC-GAMER 8000 iQ9650 VU - \u00e5\u00a0 \u00c7 Produktmer", // "changed": "2021-02-21T18:20:39+0100", // "priceGroupActive": false, // "lastStock": false, // "crossBundleLook": 0, // "notification": true, // "template": "", // "mode": 0, // "availableFrom": null, // "availableTo": null, // "mainDetail": { // "id": 11398, // "articleId": 8283, // "unitId": 9, // "number": "WT-1000104", // "supplierNumber": "", // "kind": 1, // "additionalText": "", // "active": true, // "inStock": 28, // "stockMin": null, // "lastStock": false, // "weight": "0.000", // "width": null, // "len": null, // "height": null, // "ean": "4039407005390", // "purchasePrice": "0", // "position": 1, // "minPurchase": 1, // "purchaseSteps": 0, // "maxPurchase": 0, // "purchaseUnit": "0.0000", // "referenceUnit": "1.000", // "packUnit": "Stk", // "shippingFree": false, // "releaseDate": null, // "shippingTime": "20", // "attribute": { // "id": 11271, // "articleDetailId": 11398, // "attr1": null, // "attr2": null, // "attr3": null, // "attr4": null, // "attr5": null, // "attr6": null, // "attr7": null, // "attr8": null, // "attr9": null, // "attr10": null, // "attr11": "Attributfeld 11 deutsch", // "attr12": null, // "attr13": null, // "attr14": "Wortmann - 80061", // "attr15": null, // "attr16": null, // "attr17": "21.02.2021 18:36:46", // "attr18": null, // "attr19": "21.02.2021 18:36:46", // "attr20": "0,00", // "apostroph": "" // } // } // }, // { // "id": 8284, // "mainDetailId": 11399, // "supplierId": 28, // "taxId": 1, // "priceGroupId": 1, // "filterGroupId": null, // "configuratorSetId": null, // "name": "TERRA PC-GAMER 9000 iE5420 VU\rProduktmer", // "description": "TERRA PC-GAMER 9000 iE5420 VU\rProduktmer", // "descriptionLong": "...", // "added": "2000-01-01T00:00:00+0100", // "active": true, // "pseudoSales": 0, // "highlight": false, // "keywords": null, // "metaTitle": "TERRA PC-GAMER 9000 iE5420 VU\rProduktmer", // "changed": "2021-02-21T18:20:35+0100", // "priceGroupActive": false, // "lastStock": true, // "crossBundleLook": 0, // "notification": true, // "template": "", // "mode": 0, // "availableFrom": null, // "availableTo": null, // "mainDetail": { // "id": 11399, // "articleId": 8284, // "unitId": 9, // "number": "WT-1000105", // "supplierNumber": "", // "kind": 1, // "additionalText": "", // "active": true, // "inStock": 0, // "stockMin": null, // "lastStock": true, // "weight": "0.000", // "width": null, // "len": null, // "height": null, // "ean": "4039407006137", // "purchasePrice": "0", // "position": 1, // "minPurchase": 1, // "purchaseSteps": 0, // "maxPurchase": 0, // "purchaseUnit": "0.0000", // "referenceUnit": "1.000", // "packUnit": "Stk", // "shippingFree": false, // "releaseDate": null, // "shippingTime": "20", // "attribute": { // "id": 11272, // "articleDetailId": 11399, // "attr1": null, // "attr2": null, // "attr3": null, // "attr4": null, // "attr5": null, // "attr6": null, // "attr7": null, // "attr8": null, // "attr9": null, // "attr10": null, // "attr11": "Attributfeld 11 deutsch", // "attr12": null, // "attr13": null, // "attr14": "Wortmann - 80061", // "attr15": null, // "attr16": null, // "attr17": "21.02.2021 18:36:50", // "attr18": null, // "attr19": "21.02.2021 18:36:50", // "attr20": "0,00", // "apostroph": "" // } // } // } // ], // "total": 9, // "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 mainDetailId: Int var supplierId: Int var taxId: Int var priceGroupId: Int var filterGroupId: String? var configuratorSetId: String? var name: String? var description: String? var descriptionLong: String? var added: String? var active: Bool var pseudoSales: Int var highlight: Bool var keywords: String? var metaTitle: String? var changed: String? var priceGroupActive: Bool var lastStock: Bool var crossBundleLook: Int var notification: Bool var template: String? var mode: Int var availableFrom: String? var availableTo: String? var mainDetailArticleId: Int var mainDetailUnitId: Int var mainDetailNumber: String? var mainDetailSupplierNumber: String? var mainDetailKind: Int var mainDetailAdditionalText: String? var mainDetailActive: Bool var mainDetailInStock: Int var mainDetailStockMin: String? var mainDetailLastStock: Bool var mainDetailWeight: String? var mainDetailWidth: String? var mainDetailLen: String? var mainDetailHeight: String? var mainDetailEan: String? var mainDetailPurchasePrice: String? var mainDetailPosition: Int var mainDetailMinPurchase: Int var mainDetailPurchaseSteps: Int var mainDetailMaxPurchase: Int var mainDetailPurchaseUnit: String? var mainDetailReferenceUnit: String? var mainDetailPackUnit: String? var mainDetailShippingFree: Bool var mainDetailReleaseDate: String? var mainDetailShippingTime: String? var mainDetailAttributeId: Int var mainDetailAttributeArticleDetailId: Int var mainDetailAttributeAttr1: String? var mainDetailAttributeAttr2: String? var mainDetailAttributeAttr3: String? var mainDetailAttributeAttr4: String? var mainDetailAttributeAttr5: String? var mainDetailAttributeAttr6: String? var mainDetailAttributeAttr7: String? var mainDetailAttributeAttr8: String? var mainDetailAttributeAttr9: String? var mainDetailAttributeAttr10: String? var mainDetailAttributeAttr11: String? var mainDetailAttributeAttr12: String? var mainDetailAttributeAttr13: String? var mainDetailAttributeAttr14: String? var mainDetailAttributeAttr15: String? var mainDetailAttributeAttr16: String? var mainDetailAttributeAttr17: String? var mainDetailAttributeAttr18: String? var mainDetailAttributeAttr19: String? var mainDetailAttributeAttr20: String? var mainDetailAttributeApostroph: 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 mainDetailId = jResp.int(of: "data[i].mainDetailId").intValue supplierId = jResp.int(of: "data[i].supplierId").intValue taxId = jResp.int(of: "data[i].taxId").intValue priceGroupId = jResp.int(of: "data[i].priceGroupId").intValue filterGroupId = jResp.string(of: "data[i].filterGroupId") configuratorSetId = jResp.string(of: "data[i].configuratorSetId") name = jResp.string(of: "data[i].name") description = jResp.string(of: "data[i].description") descriptionLong = jResp.string(of: "data[i].descriptionLong") added = jResp.string(of: "data[i].added") active = jResp.bool(of: "data[i].active") pseudoSales = jResp.int(of: "data[i].pseudoSales").intValue highlight = jResp.bool(of: "data[i].highlight") keywords = jResp.string(of: "data[i].keywords") metaTitle = jResp.string(of: "data[i].metaTitle") changed = jResp.string(of: "data[i].changed") priceGroupActive = jResp.bool(of: "data[i].priceGroupActive") lastStock = jResp.bool(of: "data[i].lastStock") crossBundleLook = jResp.int(of: "data[i].crossBundleLook").intValue notification = jResp.bool(of: "data[i].notification") template = jResp.string(of: "data[i].template") mode = jResp.int(of: "data[i].mode").intValue availableFrom = jResp.string(of: "data[i].availableFrom") availableTo = jResp.string(of: "data[i].availableTo") mainDetailId = jResp.int(of: "data[i].mainDetail.id").intValue mainDetailArticleId = jResp.int(of: "data[i].mainDetail.articleId").intValue mainDetailUnitId = jResp.int(of: "data[i].mainDetail.unitId").intValue mainDetailNumber = jResp.string(of: "data[i].mainDetail.number") mainDetailSupplierNumber = jResp.string(of: "data[i].mainDetail.supplierNumber") mainDetailKind = jResp.int(of: "data[i].mainDetail.kind").intValue mainDetailAdditionalText = jResp.string(of: "data[i].mainDetail.additionalText") mainDetailActive = jResp.bool(of: "data[i].mainDetail.active") mainDetailInStock = jResp.int(of: "data[i].mainDetail.inStock").intValue mainDetailStockMin = jResp.string(of: "data[i].mainDetail.stockMin") mainDetailLastStock = jResp.bool(of: "data[i].mainDetail.lastStock") mainDetailWeight = jResp.string(of: "data[i].mainDetail.weight") mainDetailWidth = jResp.string(of: "data[i].mainDetail.width") mainDetailLen = jResp.string(of: "data[i].mainDetail.len") mainDetailHeight = jResp.string(of: "data[i].mainDetail.height") mainDetailEan = jResp.string(of: "data[i].mainDetail.ean") mainDetailPurchasePrice = jResp.string(of: "data[i].mainDetail.purchasePrice") mainDetailPosition = jResp.int(of: "data[i].mainDetail.position").intValue mainDetailMinPurchase = jResp.int(of: "data[i].mainDetail.minPurchase").intValue mainDetailPurchaseSteps = jResp.int(of: "data[i].mainDetail.purchaseSteps").intValue mainDetailMaxPurchase = jResp.int(of: "data[i].mainDetail.maxPurchase").intValue mainDetailPurchaseUnit = jResp.string(of: "data[i].mainDetail.purchaseUnit") mainDetailReferenceUnit = jResp.string(of: "data[i].mainDetail.referenceUnit") mainDetailPackUnit = jResp.string(of: "data[i].mainDetail.packUnit") mainDetailShippingFree = jResp.bool(of: "data[i].mainDetail.shippingFree") mainDetailReleaseDate = jResp.string(of: "data[i].mainDetail.releaseDate") mainDetailShippingTime = jResp.string(of: "data[i].mainDetail.shippingTime") mainDetailAttributeId = jResp.int(of: "data[i].mainDetail.attribute.id").intValue mainDetailAttributeArticleDetailId = jResp.int(of: "data[i].mainDetail.attribute.articleDetailId").intValue mainDetailAttributeAttr1 = jResp.string(of: "data[i].mainDetail.attribute.attr1") mainDetailAttributeAttr2 = jResp.string(of: "data[i].mainDetail.attribute.attr2") mainDetailAttributeAttr3 = jResp.string(of: "data[i].mainDetail.attribute.attr3") mainDetailAttributeAttr4 = jResp.string(of: "data[i].mainDetail.attribute.attr4") mainDetailAttributeAttr5 = jResp.string(of: "data[i].mainDetail.attribute.attr5") mainDetailAttributeAttr6 = jResp.string(of: "data[i].mainDetail.attribute.attr6") mainDetailAttributeAttr7 = jResp.string(of: "data[i].mainDetail.attribute.attr7") mainDetailAttributeAttr8 = jResp.string(of: "data[i].mainDetail.attribute.attr8") mainDetailAttributeAttr9 = jResp.string(of: "data[i].mainDetail.attribute.attr9") mainDetailAttributeAttr10 = jResp.string(of: "data[i].mainDetail.attribute.attr10") mainDetailAttributeAttr11 = jResp.string(of: "data[i].mainDetail.attribute.attr11") mainDetailAttributeAttr12 = jResp.string(of: "data[i].mainDetail.attribute.attr12") mainDetailAttributeAttr13 = jResp.string(of: "data[i].mainDetail.attribute.attr13") mainDetailAttributeAttr14 = jResp.string(of: "data[i].mainDetail.attribute.attr14") mainDetailAttributeAttr15 = jResp.string(of: "data[i].mainDetail.attribute.attr15") mainDetailAttributeAttr16 = jResp.string(of: "data[i].mainDetail.attribute.attr16") mainDetailAttributeAttr17 = jResp.string(of: "data[i].mainDetail.attribute.attr17") mainDetailAttributeAttr18 = jResp.string(of: "data[i].mainDetail.attribute.attr18") mainDetailAttributeAttr19 = jResp.string(of: "data[i].mainDetail.attribute.attr19") mainDetailAttributeAttr20 = jResp.string(of: "data[i].mainDetail.attribute.attr20") mainDetailAttributeApostroph = jResp.string(of: "data[i].mainDetail.attribute.apostroph") i = i + 1 } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.