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
(PureBasic) 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/
IncludeFile "CkHttp.pb" IncludeFile "CkStringBuilder.pb" IncludeFile "CkJsonObject.pb" Procedure ChilkatExample() ; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkHttp::setCkLogin(http, "api_username") CkHttp::setCkPassword(http, "api_key") CkHttp::setCkBasicAuth(http, 1) sbResponseBody.i = CkStringBuilder::ckCreate() If sbResponseBody.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i = CkHttp::ckQuickGetSb(http,"https://my-shopware-shop.com/api/articles?limit=2",sbResponseBody) If success = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkStringBuilder::ckDispose(sbResponseBody) ProcedureReturn EndIf jResp.i = CkJsonObject::ckCreate() If jResp.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkJsonObject::ckLoadSb(jResp,sbResponseBody) CkJsonObject::setCkEmitCompact(jResp, 0) Debug "Response Body:" Debug CkJsonObject::ckEmit(jResp) ; 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 id.i mainDetailId.i supplierId.i taxId.i priceGroupId.i filterGroupId.s configuratorSetId.s name.s description.s descriptionLong.s added.s active.i pseudoSales.i highlight.i keywords.s metaTitle.s changed.s priceGroupActive.i lastStock.i crossBundleLook.i notification.i template.s mode.i availableFrom.s availableTo.s mainDetailArticleId.i mainDetailUnitId.i mainDetailNumber.s mainDetailSupplierNumber.s mainDetailKind.i mainDetailAdditionalText.s mainDetailActive.i mainDetailInStock.i mainDetailStockMin.s mainDetailLastStock.i mainDetailWeight.s mainDetailWidth.s mainDetailLen.s mainDetailHeight.s mainDetailEan.s mainDetailPurchasePrice.s mainDetailPosition.i mainDetailMinPurchase.i mainDetailPurchaseSteps.i mainDetailMaxPurchase.i mainDetailPurchaseUnit.s mainDetailReferenceUnit.s mainDetailPackUnit.s mainDetailShippingFree.i mainDetailReleaseDate.s mainDetailShippingTime.s mainDetailAttributeId.i mainDetailAttributeArticleDetailId.i mainDetailAttributeAttr1.s mainDetailAttributeAttr2.s mainDetailAttributeAttr3.s mainDetailAttributeAttr4.s mainDetailAttributeAttr5.s mainDetailAttributeAttr6.s mainDetailAttributeAttr7.s mainDetailAttributeAttr8.s mainDetailAttributeAttr9.s mainDetailAttributeAttr10.s mainDetailAttributeAttr11.s mainDetailAttributeAttr12.s mainDetailAttributeAttr13.s mainDetailAttributeAttr14.s mainDetailAttributeAttr15.s mainDetailAttributeAttr16.s mainDetailAttributeAttr17.s mainDetailAttributeAttr18.s mainDetailAttributeAttr19.s mainDetailAttributeAttr20.s mainDetailAttributeApostroph.s total.i = CkJsonObject::ckIntOf(jResp,"total") success.i = CkJsonObject::ckBoolOf(jResp,"success") i.i = 0 count_i.i = CkJsonObject::ckSizeOfArray(jResp,"data") While i < count_i CkJsonObject::setCkI(jResp, i) id = CkJsonObject::ckIntOf(jResp,"data[i].id") mainDetailId = CkJsonObject::ckIntOf(jResp,"data[i].mainDetailId") supplierId = CkJsonObject::ckIntOf(jResp,"data[i].supplierId") taxId = CkJsonObject::ckIntOf(jResp,"data[i].taxId") priceGroupId = CkJsonObject::ckIntOf(jResp,"data[i].priceGroupId") filterGroupId = CkJsonObject::ckStringOf(jResp,"data[i].filterGroupId") configuratorSetId = CkJsonObject::ckStringOf(jResp,"data[i].configuratorSetId") name = CkJsonObject::ckStringOf(jResp,"data[i].name") description = CkJsonObject::ckStringOf(jResp,"data[i].description") descriptionLong = CkJsonObject::ckStringOf(jResp,"data[i].descriptionLong") added = CkJsonObject::ckStringOf(jResp,"data[i].added") active = CkJsonObject::ckBoolOf(jResp,"data[i].active") pseudoSales = CkJsonObject::ckIntOf(jResp,"data[i].pseudoSales") highlight = CkJsonObject::ckBoolOf(jResp,"data[i].highlight") keywords = CkJsonObject::ckStringOf(jResp,"data[i].keywords") metaTitle = CkJsonObject::ckStringOf(jResp,"data[i].metaTitle") changed = CkJsonObject::ckStringOf(jResp,"data[i].changed") priceGroupActive = CkJsonObject::ckBoolOf(jResp,"data[i].priceGroupActive") lastStock = CkJsonObject::ckBoolOf(jResp,"data[i].lastStock") crossBundleLook = CkJsonObject::ckIntOf(jResp,"data[i].crossBundleLook") notification = CkJsonObject::ckBoolOf(jResp,"data[i].notification") template = CkJsonObject::ckStringOf(jResp,"data[i].template") mode = CkJsonObject::ckIntOf(jResp,"data[i].mode") availableFrom = CkJsonObject::ckStringOf(jResp,"data[i].availableFrom") availableTo = CkJsonObject::ckStringOf(jResp,"data[i].availableTo") mainDetailId = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.id") mainDetailArticleId = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.articleId") mainDetailUnitId = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.unitId") mainDetailNumber = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.number") mainDetailSupplierNumber = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.supplierNumber") mainDetailKind = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.kind") mainDetailAdditionalText = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.additionalText") mainDetailActive = CkJsonObject::ckBoolOf(jResp,"data[i].mainDetail.active") mainDetailInStock = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.inStock") mainDetailStockMin = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.stockMin") mainDetailLastStock = CkJsonObject::ckBoolOf(jResp,"data[i].mainDetail.lastStock") mainDetailWeight = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.weight") mainDetailWidth = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.width") mainDetailLen = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.len") mainDetailHeight = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.height") mainDetailEan = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.ean") mainDetailPurchasePrice = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.purchasePrice") mainDetailPosition = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.position") mainDetailMinPurchase = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.minPurchase") mainDetailPurchaseSteps = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.purchaseSteps") mainDetailMaxPurchase = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.maxPurchase") mainDetailPurchaseUnit = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.purchaseUnit") mainDetailReferenceUnit = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.referenceUnit") mainDetailPackUnit = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.packUnit") mainDetailShippingFree = CkJsonObject::ckBoolOf(jResp,"data[i].mainDetail.shippingFree") mainDetailReleaseDate = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.releaseDate") mainDetailShippingTime = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.shippingTime") mainDetailAttributeId = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.attribute.id") mainDetailAttributeArticleDetailId = CkJsonObject::ckIntOf(jResp,"data[i].mainDetail.attribute.articleDetailId") mainDetailAttributeAttr1 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr1") mainDetailAttributeAttr2 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr2") mainDetailAttributeAttr3 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr3") mainDetailAttributeAttr4 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr4") mainDetailAttributeAttr5 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr5") mainDetailAttributeAttr6 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr6") mainDetailAttributeAttr7 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr7") mainDetailAttributeAttr8 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr8") mainDetailAttributeAttr9 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr9") mainDetailAttributeAttr10 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr10") mainDetailAttributeAttr11 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr11") mainDetailAttributeAttr12 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr12") mainDetailAttributeAttr13 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr13") mainDetailAttributeAttr14 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr14") mainDetailAttributeAttr15 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr15") mainDetailAttributeAttr16 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr16") mainDetailAttributeAttr17 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr17") mainDetailAttributeAttr18 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr18") mainDetailAttributeAttr19 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr19") mainDetailAttributeAttr20 = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.attr20") mainDetailAttributeApostroph = CkJsonObject::ckStringOf(jResp,"data[i].mainDetail.attribute.apostroph") i = i + 1 Wend CkHttp::ckDispose(http) CkStringBuilder::ckDispose(sbResponseBody) CkJsonObject::ckDispose(jResp) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.