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
(Objective-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/
#import <CkoHttp.h> #import <CkoStringBuilder.h> #import <CkoJsonObject.h> #import <NSString.h> // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. CkoHttp *http = [[CkoHttp alloc] init]; http.Login = @"api_username"; http.Password = @"api_key"; http.BasicAuth = YES; CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init]; BOOL success = [http QuickGetSb: @"https://my-shopware-shop.com/api/articles?limit=2" sbContent: sbResponseBody]; if (success == NO) { NSLog(@"%@",http.LastErrorText); return; } CkoJsonObject *jResp = [[CkoJsonObject alloc] init]; [jResp LoadSb: sbResponseBody]; jResp.EmitCompact = NO; NSLog(@"%@",@"Response Body:"); NSLog(@"%@",[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 int id; int mainDetailId; int supplierId; int taxId; int priceGroupId; NSString *filterGroupId = 0; NSString *configuratorSetId = 0; NSString *name = 0; NSString *description = 0; NSString *descriptionLong = 0; NSString *added = 0; BOOL active; int pseudoSales; BOOL highlight; NSString *keywords = 0; NSString *metaTitle = 0; NSString *changed = 0; BOOL priceGroupActive; BOOL lastStock; int crossBundleLook; BOOL notification; NSString *template = 0; int mode; NSString *availableFrom = 0; NSString *availableTo = 0; int mainDetailArticleId; int mainDetailUnitId; NSString *mainDetailNumber = 0; NSString *mainDetailSupplierNumber = 0; int mainDetailKind; NSString *mainDetailAdditionalText = 0; BOOL mainDetailActive; int mainDetailInStock; NSString *mainDetailStockMin = 0; BOOL mainDetailLastStock; NSString *mainDetailWeight = 0; NSString *mainDetailWidth = 0; NSString *mainDetailLen = 0; NSString *mainDetailHeight = 0; NSString *mainDetailEan = 0; NSString *mainDetailPurchasePrice = 0; int mainDetailPosition; int mainDetailMinPurchase; int mainDetailPurchaseSteps; int mainDetailMaxPurchase; NSString *mainDetailPurchaseUnit = 0; NSString *mainDetailReferenceUnit = 0; NSString *mainDetailPackUnit = 0; BOOL mainDetailShippingFree; NSString *mainDetailReleaseDate = 0; NSString *mainDetailShippingTime = 0; int mainDetailAttributeId; int mainDetailAttributeArticleDetailId; NSString *mainDetailAttributeAttr1 = 0; NSString *mainDetailAttributeAttr2 = 0; NSString *mainDetailAttributeAttr3 = 0; NSString *mainDetailAttributeAttr4 = 0; NSString *mainDetailAttributeAttr5 = 0; NSString *mainDetailAttributeAttr6 = 0; NSString *mainDetailAttributeAttr7 = 0; NSString *mainDetailAttributeAttr8 = 0; NSString *mainDetailAttributeAttr9 = 0; NSString *mainDetailAttributeAttr10 = 0; NSString *mainDetailAttributeAttr11 = 0; NSString *mainDetailAttributeAttr12 = 0; NSString *mainDetailAttributeAttr13 = 0; NSString *mainDetailAttributeAttr14 = 0; NSString *mainDetailAttributeAttr15 = 0; NSString *mainDetailAttributeAttr16 = 0; NSString *mainDetailAttributeAttr17 = 0; NSString *mainDetailAttributeAttr18 = 0; NSString *mainDetailAttributeAttr19 = 0; NSString *mainDetailAttributeAttr20 = 0; NSString *mainDetailAttributeApostroph = 0; int total = [[jResp IntOf: @"total"] intValue]; BOOL success = [jResp BoolOf: @"success"]; int i = 0; int count_i = [[jResp SizeOfArray: @"data"] intValue]; while (i < count_i) { jResp.I = [NSNumber numberWithInt: i]; id = [[jResp IntOf: @"data[i].id"] intValue]; mainDetailId = [[jResp IntOf: @"data[i].mainDetailId"] intValue]; supplierId = [[jResp IntOf: @"data[i].supplierId"] intValue]; taxId = [[jResp IntOf: @"data[i].taxId"] intValue]; priceGroupId = [[jResp IntOf: @"data[i].priceGroupId"] intValue]; filterGroupId = [jResp StringOf: @"data[i].filterGroupId"]; configuratorSetId = [jResp StringOf: @"data[i].configuratorSetId"]; name = [jResp StringOf: @"data[i].name"]; description = [jResp StringOf: @"data[i].description"]; descriptionLong = [jResp StringOf: @"data[i].descriptionLong"]; added = [jResp StringOf: @"data[i].added"]; active = [jResp BoolOf: @"data[i].active"]; pseudoSales = [[jResp IntOf: @"data[i].pseudoSales"] intValue]; highlight = [jResp BoolOf: @"data[i].highlight"]; keywords = [jResp StringOf: @"data[i].keywords"]; metaTitle = [jResp StringOf: @"data[i].metaTitle"]; changed = [jResp StringOf: @"data[i].changed"]; priceGroupActive = [jResp BoolOf: @"data[i].priceGroupActive"]; lastStock = [jResp BoolOf: @"data[i].lastStock"]; crossBundleLook = [[jResp IntOf: @"data[i].crossBundleLook"] intValue]; notification = [jResp BoolOf: @"data[i].notification"]; template = [jResp StringOf: @"data[i].template"]; mode = [[jResp IntOf: @"data[i].mode"] intValue]; availableFrom = [jResp StringOf: @"data[i].availableFrom"]; availableTo = [jResp StringOf: @"data[i].availableTo"]; mainDetailId = [[jResp IntOf: @"data[i].mainDetail.id"] intValue]; mainDetailArticleId = [[jResp IntOf: @"data[i].mainDetail.articleId"] intValue]; mainDetailUnitId = [[jResp IntOf: @"data[i].mainDetail.unitId"] intValue]; mainDetailNumber = [jResp StringOf: @"data[i].mainDetail.number"]; mainDetailSupplierNumber = [jResp StringOf: @"data[i].mainDetail.supplierNumber"]; mainDetailKind = [[jResp IntOf: @"data[i].mainDetail.kind"] intValue]; mainDetailAdditionalText = [jResp StringOf: @"data[i].mainDetail.additionalText"]; mainDetailActive = [jResp BoolOf: @"data[i].mainDetail.active"]; mainDetailInStock = [[jResp IntOf: @"data[i].mainDetail.inStock"] intValue]; mainDetailStockMin = [jResp StringOf: @"data[i].mainDetail.stockMin"]; mainDetailLastStock = [jResp BoolOf: @"data[i].mainDetail.lastStock"]; mainDetailWeight = [jResp StringOf: @"data[i].mainDetail.weight"]; mainDetailWidth = [jResp StringOf: @"data[i].mainDetail.width"]; mainDetailLen = [jResp StringOf: @"data[i].mainDetail.len"]; mainDetailHeight = [jResp StringOf: @"data[i].mainDetail.height"]; mainDetailEan = [jResp StringOf: @"data[i].mainDetail.ean"]; mainDetailPurchasePrice = [jResp StringOf: @"data[i].mainDetail.purchasePrice"]; mainDetailPosition = [[jResp IntOf: @"data[i].mainDetail.position"] intValue]; mainDetailMinPurchase = [[jResp IntOf: @"data[i].mainDetail.minPurchase"] intValue]; mainDetailPurchaseSteps = [[jResp IntOf: @"data[i].mainDetail.purchaseSteps"] intValue]; mainDetailMaxPurchase = [[jResp IntOf: @"data[i].mainDetail.maxPurchase"] intValue]; mainDetailPurchaseUnit = [jResp StringOf: @"data[i].mainDetail.purchaseUnit"]; mainDetailReferenceUnit = [jResp StringOf: @"data[i].mainDetail.referenceUnit"]; mainDetailPackUnit = [jResp StringOf: @"data[i].mainDetail.packUnit"]; mainDetailShippingFree = [jResp BoolOf: @"data[i].mainDetail.shippingFree"]; mainDetailReleaseDate = [jResp StringOf: @"data[i].mainDetail.releaseDate"]; mainDetailShippingTime = [jResp StringOf: @"data[i].mainDetail.shippingTime"]; mainDetailAttributeId = [[jResp IntOf: @"data[i].mainDetail.attribute.id"] intValue]; mainDetailAttributeArticleDetailId = [[jResp IntOf: @"data[i].mainDetail.attribute.articleDetailId"] intValue]; mainDetailAttributeAttr1 = [jResp StringOf: @"data[i].mainDetail.attribute.attr1"]; mainDetailAttributeAttr2 = [jResp StringOf: @"data[i].mainDetail.attribute.attr2"]; mainDetailAttributeAttr3 = [jResp StringOf: @"data[i].mainDetail.attribute.attr3"]; mainDetailAttributeAttr4 = [jResp StringOf: @"data[i].mainDetail.attribute.attr4"]; mainDetailAttributeAttr5 = [jResp StringOf: @"data[i].mainDetail.attribute.attr5"]; mainDetailAttributeAttr6 = [jResp StringOf: @"data[i].mainDetail.attribute.attr6"]; mainDetailAttributeAttr7 = [jResp StringOf: @"data[i].mainDetail.attribute.attr7"]; mainDetailAttributeAttr8 = [jResp StringOf: @"data[i].mainDetail.attribute.attr8"]; mainDetailAttributeAttr9 = [jResp StringOf: @"data[i].mainDetail.attribute.attr9"]; mainDetailAttributeAttr10 = [jResp StringOf: @"data[i].mainDetail.attribute.attr10"]; mainDetailAttributeAttr11 = [jResp StringOf: @"data[i].mainDetail.attribute.attr11"]; mainDetailAttributeAttr12 = [jResp StringOf: @"data[i].mainDetail.attribute.attr12"]; mainDetailAttributeAttr13 = [jResp StringOf: @"data[i].mainDetail.attribute.attr13"]; mainDetailAttributeAttr14 = [jResp StringOf: @"data[i].mainDetail.attribute.attr14"]; mainDetailAttributeAttr15 = [jResp StringOf: @"data[i].mainDetail.attribute.attr15"]; mainDetailAttributeAttr16 = [jResp StringOf: @"data[i].mainDetail.attribute.attr16"]; mainDetailAttributeAttr17 = [jResp StringOf: @"data[i].mainDetail.attribute.attr17"]; mainDetailAttributeAttr18 = [jResp StringOf: @"data[i].mainDetail.attribute.attr18"]; mainDetailAttributeAttr19 = [jResp StringOf: @"data[i].mainDetail.attribute.attr19"]; mainDetailAttributeAttr20 = [jResp StringOf: @"data[i].mainDetail.attribute.attr20"]; mainDetailAttributeApostroph = [jResp StringOf: @"data[i].mainDetail.attribute.apostroph"]; i = i + 1; } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.