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
(Unicode C++) 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/
#include <CkHttpW.h> #include <CkStringBuilderW.h> #include <CkJsonObjectW.h> void ChilkatSample(void) { // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkHttpW http; http.put_Login(L"api_username"); http.put_Password(L"api_key"); http.put_BasicAuth(true); CkStringBuilderW sbResponseBody; bool success = http.QuickGetSb(L"https://my-shopware-shop.com/api/articles?limit=2",sbResponseBody); if (success == false) { wprintf(L"%s\n",http.lastErrorText()); return; } CkJsonObjectW jResp; jResp.LoadSb(sbResponseBody); jResp.put_EmitCompact(false); wprintf(L"Response Body:\n"); wprintf(L"%s\n",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 // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat. // See this example explaining how this memory should be used: const char * functions. int id; int mainDetailId; int supplierId; int taxId; int priceGroupId; const wchar_t *filterGroupId = 0; const wchar_t *configuratorSetId = 0; const wchar_t *name = 0; const wchar_t *description = 0; const wchar_t *descriptionLong = 0; const wchar_t *added = 0; bool active; int pseudoSales; bool highlight; const wchar_t *keywords = 0; const wchar_t *metaTitle = 0; const wchar_t *changed = 0; bool priceGroupActive; bool lastStock; int crossBundleLook; bool notification; const wchar_t *template = 0; int mode; const wchar_t *availableFrom = 0; const wchar_t *availableTo = 0; int mainDetailArticleId; int mainDetailUnitId; const wchar_t *mainDetailNumber = 0; const wchar_t *mainDetailSupplierNumber = 0; int mainDetailKind; const wchar_t *mainDetailAdditionalText = 0; bool mainDetailActive; int mainDetailInStock; const wchar_t *mainDetailStockMin = 0; bool mainDetailLastStock; const wchar_t *mainDetailWeight = 0; const wchar_t *mainDetailWidth = 0; const wchar_t *mainDetailLen = 0; const wchar_t *mainDetailHeight = 0; const wchar_t *mainDetailEan = 0; const wchar_t *mainDetailPurchasePrice = 0; int mainDetailPosition; int mainDetailMinPurchase; int mainDetailPurchaseSteps; int mainDetailMaxPurchase; const wchar_t *mainDetailPurchaseUnit = 0; const wchar_t *mainDetailReferenceUnit = 0; const wchar_t *mainDetailPackUnit = 0; bool mainDetailShippingFree; const wchar_t *mainDetailReleaseDate = 0; const wchar_t *mainDetailShippingTime = 0; int mainDetailAttributeId; int mainDetailAttributeArticleDetailId; const wchar_t *mainDetailAttributeAttr1 = 0; const wchar_t *mainDetailAttributeAttr2 = 0; const wchar_t *mainDetailAttributeAttr3 = 0; const wchar_t *mainDetailAttributeAttr4 = 0; const wchar_t *mainDetailAttributeAttr5 = 0; const wchar_t *mainDetailAttributeAttr6 = 0; const wchar_t *mainDetailAttributeAttr7 = 0; const wchar_t *mainDetailAttributeAttr8 = 0; const wchar_t *mainDetailAttributeAttr9 = 0; const wchar_t *mainDetailAttributeAttr10 = 0; const wchar_t *mainDetailAttributeAttr11 = 0; const wchar_t *mainDetailAttributeAttr12 = 0; const wchar_t *mainDetailAttributeAttr13 = 0; const wchar_t *mainDetailAttributeAttr14 = 0; const wchar_t *mainDetailAttributeAttr15 = 0; const wchar_t *mainDetailAttributeAttr16 = 0; const wchar_t *mainDetailAttributeAttr17 = 0; const wchar_t *mainDetailAttributeAttr18 = 0; const wchar_t *mainDetailAttributeAttr19 = 0; const wchar_t *mainDetailAttributeAttr20 = 0; const wchar_t *mainDetailAttributeApostroph = 0; int total = jResp.IntOf(L"total"); bool success = jResp.BoolOf(L"success"); int i = 0; int count_i = jResp.SizeOfArray(L"data"); while (i < count_i) { jResp.put_I(i); id = jResp.IntOf(L"data[i].id"); mainDetailId = jResp.IntOf(L"data[i].mainDetailId"); supplierId = jResp.IntOf(L"data[i].supplierId"); taxId = jResp.IntOf(L"data[i].taxId"); priceGroupId = jResp.IntOf(L"data[i].priceGroupId"); filterGroupId = jResp.stringOf(L"data[i].filterGroupId"); configuratorSetId = jResp.stringOf(L"data[i].configuratorSetId"); name = jResp.stringOf(L"data[i].name"); description = jResp.stringOf(L"data[i].description"); descriptionLong = jResp.stringOf(L"data[i].descriptionLong"); added = jResp.stringOf(L"data[i].added"); active = jResp.BoolOf(L"data[i].active"); pseudoSales = jResp.IntOf(L"data[i].pseudoSales"); highlight = jResp.BoolOf(L"data[i].highlight"); keywords = jResp.stringOf(L"data[i].keywords"); metaTitle = jResp.stringOf(L"data[i].metaTitle"); changed = jResp.stringOf(L"data[i].changed"); priceGroupActive = jResp.BoolOf(L"data[i].priceGroupActive"); lastStock = jResp.BoolOf(L"data[i].lastStock"); crossBundleLook = jResp.IntOf(L"data[i].crossBundleLook"); notification = jResp.BoolOf(L"data[i].notification"); template = jResp.stringOf(L"data[i].template"); mode = jResp.IntOf(L"data[i].mode"); availableFrom = jResp.stringOf(L"data[i].availableFrom"); availableTo = jResp.stringOf(L"data[i].availableTo"); mainDetailId = jResp.IntOf(L"data[i].mainDetail.id"); mainDetailArticleId = jResp.IntOf(L"data[i].mainDetail.articleId"); mainDetailUnitId = jResp.IntOf(L"data[i].mainDetail.unitId"); mainDetailNumber = jResp.stringOf(L"data[i].mainDetail.number"); mainDetailSupplierNumber = jResp.stringOf(L"data[i].mainDetail.supplierNumber"); mainDetailKind = jResp.IntOf(L"data[i].mainDetail.kind"); mainDetailAdditionalText = jResp.stringOf(L"data[i].mainDetail.additionalText"); mainDetailActive = jResp.BoolOf(L"data[i].mainDetail.active"); mainDetailInStock = jResp.IntOf(L"data[i].mainDetail.inStock"); mainDetailStockMin = jResp.stringOf(L"data[i].mainDetail.stockMin"); mainDetailLastStock = jResp.BoolOf(L"data[i].mainDetail.lastStock"); mainDetailWeight = jResp.stringOf(L"data[i].mainDetail.weight"); mainDetailWidth = jResp.stringOf(L"data[i].mainDetail.width"); mainDetailLen = jResp.stringOf(L"data[i].mainDetail.len"); mainDetailHeight = jResp.stringOf(L"data[i].mainDetail.height"); mainDetailEan = jResp.stringOf(L"data[i].mainDetail.ean"); mainDetailPurchasePrice = jResp.stringOf(L"data[i].mainDetail.purchasePrice"); mainDetailPosition = jResp.IntOf(L"data[i].mainDetail.position"); mainDetailMinPurchase = jResp.IntOf(L"data[i].mainDetail.minPurchase"); mainDetailPurchaseSteps = jResp.IntOf(L"data[i].mainDetail.purchaseSteps"); mainDetailMaxPurchase = jResp.IntOf(L"data[i].mainDetail.maxPurchase"); mainDetailPurchaseUnit = jResp.stringOf(L"data[i].mainDetail.purchaseUnit"); mainDetailReferenceUnit = jResp.stringOf(L"data[i].mainDetail.referenceUnit"); mainDetailPackUnit = jResp.stringOf(L"data[i].mainDetail.packUnit"); mainDetailShippingFree = jResp.BoolOf(L"data[i].mainDetail.shippingFree"); mainDetailReleaseDate = jResp.stringOf(L"data[i].mainDetail.releaseDate"); mainDetailShippingTime = jResp.stringOf(L"data[i].mainDetail.shippingTime"); mainDetailAttributeId = jResp.IntOf(L"data[i].mainDetail.attribute.id"); mainDetailAttributeArticleDetailId = jResp.IntOf(L"data[i].mainDetail.attribute.articleDetailId"); mainDetailAttributeAttr1 = jResp.stringOf(L"data[i].mainDetail.attribute.attr1"); mainDetailAttributeAttr2 = jResp.stringOf(L"data[i].mainDetail.attribute.attr2"); mainDetailAttributeAttr3 = jResp.stringOf(L"data[i].mainDetail.attribute.attr3"); mainDetailAttributeAttr4 = jResp.stringOf(L"data[i].mainDetail.attribute.attr4"); mainDetailAttributeAttr5 = jResp.stringOf(L"data[i].mainDetail.attribute.attr5"); mainDetailAttributeAttr6 = jResp.stringOf(L"data[i].mainDetail.attribute.attr6"); mainDetailAttributeAttr7 = jResp.stringOf(L"data[i].mainDetail.attribute.attr7"); mainDetailAttributeAttr8 = jResp.stringOf(L"data[i].mainDetail.attribute.attr8"); mainDetailAttributeAttr9 = jResp.stringOf(L"data[i].mainDetail.attribute.attr9"); mainDetailAttributeAttr10 = jResp.stringOf(L"data[i].mainDetail.attribute.attr10"); mainDetailAttributeAttr11 = jResp.stringOf(L"data[i].mainDetail.attribute.attr11"); mainDetailAttributeAttr12 = jResp.stringOf(L"data[i].mainDetail.attribute.attr12"); mainDetailAttributeAttr13 = jResp.stringOf(L"data[i].mainDetail.attribute.attr13"); mainDetailAttributeAttr14 = jResp.stringOf(L"data[i].mainDetail.attribute.attr14"); mainDetailAttributeAttr15 = jResp.stringOf(L"data[i].mainDetail.attribute.attr15"); mainDetailAttributeAttr16 = jResp.stringOf(L"data[i].mainDetail.attribute.attr16"); mainDetailAttributeAttr17 = jResp.stringOf(L"data[i].mainDetail.attribute.attr17"); mainDetailAttributeAttr18 = jResp.stringOf(L"data[i].mainDetail.attribute.attr18"); mainDetailAttributeAttr19 = jResp.stringOf(L"data[i].mainDetail.attribute.attr19"); mainDetailAttributeAttr20 = jResp.stringOf(L"data[i].mainDetail.attribute.attr20"); mainDetailAttributeApostroph = jResp.stringOf(L"data[i].mainDetail.attribute.apostroph"); i = i + 1; } } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.