Sample code for 30+ languages & platforms
Lianja

Shopware List Articles

See more Shopware Examples

This 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.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loHttp = createobject("CkHttp")

loHttp.Login = "api_username"
loHttp.Password = "api_key"
loHttp.BasicAuth = .T.

loSbResponseBody = createobject("CkStringBuilder")
llSuccess = loHttp.QuickGetSb("https://my-shopware-shop.com/api/articles?limit=2",loSbResponseBody)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loSbResponseBody
    return
endif

loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.

? "Response Body:"
? loJResp.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

lnTotal = loJResp.IntOf("total")
llSuccess = loJResp.BoolOf("success")
i = 0
lnCount_i = loJResp.SizeOfArray("data")
do while i < lnCount_i
    loJResp.I = i
    lnId = loJResp.IntOf("data[i].id")
    lnMainDetailId = loJResp.IntOf("data[i].mainDetailId")
    lnSupplierId = loJResp.IntOf("data[i].supplierId")
    lnTaxId = loJResp.IntOf("data[i].taxId")
    lnPriceGroupId = loJResp.IntOf("data[i].priceGroupId")
    lcFilterGroupId = loJResp.StringOf("data[i].filterGroupId")
    lcConfiguratorSetId = loJResp.StringOf("data[i].configuratorSetId")
    lcName = loJResp.StringOf("data[i].name")
    lcDescription = loJResp.StringOf("data[i].description")
    lcDescriptionLong = loJResp.StringOf("data[i].descriptionLong")
    lcAdded = loJResp.StringOf("data[i].added")
    llActive = loJResp.BoolOf("data[i].active")
    lnPseudoSales = loJResp.IntOf("data[i].pseudoSales")
    llHighlight = loJResp.BoolOf("data[i].highlight")
    lcKeywords = loJResp.StringOf("data[i].keywords")
    lcMetaTitle = loJResp.StringOf("data[i].metaTitle")
    lcChanged = loJResp.StringOf("data[i].changed")
    llPriceGroupActive = loJResp.BoolOf("data[i].priceGroupActive")
    llLastStock = loJResp.BoolOf("data[i].lastStock")
    lnCrossBundleLook = loJResp.IntOf("data[i].crossBundleLook")
    llNotification = loJResp.BoolOf("data[i].notification")
    lcTemplate = loJResp.StringOf("data[i].template")
    lnMode = loJResp.IntOf("data[i].mode")
    lcAvailableFrom = loJResp.StringOf("data[i].availableFrom")
    lcAvailableTo = loJResp.StringOf("data[i].availableTo")
    lnMainDetailId = loJResp.IntOf("data[i].mainDetail.id")
    lnMainDetailArticleId = loJResp.IntOf("data[i].mainDetail.articleId")
    lnMainDetailUnitId = loJResp.IntOf("data[i].mainDetail.unitId")
    lcMainDetailNumber = loJResp.StringOf("data[i].mainDetail.number")
    lcMainDetailSupplierNumber = loJResp.StringOf("data[i].mainDetail.supplierNumber")
    lnMainDetailKind = loJResp.IntOf("data[i].mainDetail.kind")
    lcMainDetailAdditionalText = loJResp.StringOf("data[i].mainDetail.additionalText")
    llMainDetailActive = loJResp.BoolOf("data[i].mainDetail.active")
    lnMainDetailInStock = loJResp.IntOf("data[i].mainDetail.inStock")
    lcMainDetailStockMin = loJResp.StringOf("data[i].mainDetail.stockMin")
    llMainDetailLastStock = loJResp.BoolOf("data[i].mainDetail.lastStock")
    lcMainDetailWeight = loJResp.StringOf("data[i].mainDetail.weight")
    lcMainDetailWidth = loJResp.StringOf("data[i].mainDetail.width")
    lcMainDetailLen = loJResp.StringOf("data[i].mainDetail.len")
    lcMainDetailHeight = loJResp.StringOf("data[i].mainDetail.height")
    lcMainDetailEan = loJResp.StringOf("data[i].mainDetail.ean")
    lcMainDetailPurchasePrice = loJResp.StringOf("data[i].mainDetail.purchasePrice")
    lnMainDetailPosition = loJResp.IntOf("data[i].mainDetail.position")
    lnMainDetailMinPurchase = loJResp.IntOf("data[i].mainDetail.minPurchase")
    lnMainDetailPurchaseSteps = loJResp.IntOf("data[i].mainDetail.purchaseSteps")
    lnMainDetailMaxPurchase = loJResp.IntOf("data[i].mainDetail.maxPurchase")
    lcMainDetailPurchaseUnit = loJResp.StringOf("data[i].mainDetail.purchaseUnit")
    lcMainDetailReferenceUnit = loJResp.StringOf("data[i].mainDetail.referenceUnit")
    lcMainDetailPackUnit = loJResp.StringOf("data[i].mainDetail.packUnit")
    llMainDetailShippingFree = loJResp.BoolOf("data[i].mainDetail.shippingFree")
    lcMainDetailReleaseDate = loJResp.StringOf("data[i].mainDetail.releaseDate")
    lcMainDetailShippingTime = loJResp.StringOf("data[i].mainDetail.shippingTime")
    lnMainDetailAttributeId = loJResp.IntOf("data[i].mainDetail.attribute.id")
    lnMainDetailAttributeArticleDetailId = loJResp.IntOf("data[i].mainDetail.attribute.articleDetailId")
    lcMainDetailAttributeAttr1 = loJResp.StringOf("data[i].mainDetail.attribute.attr1")
    lcMainDetailAttributeAttr2 = loJResp.StringOf("data[i].mainDetail.attribute.attr2")
    lcMainDetailAttributeAttr3 = loJResp.StringOf("data[i].mainDetail.attribute.attr3")
    lcMainDetailAttributeAttr4 = loJResp.StringOf("data[i].mainDetail.attribute.attr4")
    lcMainDetailAttributeAttr5 = loJResp.StringOf("data[i].mainDetail.attribute.attr5")
    lcMainDetailAttributeAttr6 = loJResp.StringOf("data[i].mainDetail.attribute.attr6")
    lcMainDetailAttributeAttr7 = loJResp.StringOf("data[i].mainDetail.attribute.attr7")
    lcMainDetailAttributeAttr8 = loJResp.StringOf("data[i].mainDetail.attribute.attr8")
    lcMainDetailAttributeAttr9 = loJResp.StringOf("data[i].mainDetail.attribute.attr9")
    lcMainDetailAttributeAttr10 = loJResp.StringOf("data[i].mainDetail.attribute.attr10")
    lcMainDetailAttributeAttr11 = loJResp.StringOf("data[i].mainDetail.attribute.attr11")
    lcMainDetailAttributeAttr12 = loJResp.StringOf("data[i].mainDetail.attribute.attr12")
    lcMainDetailAttributeAttr13 = loJResp.StringOf("data[i].mainDetail.attribute.attr13")
    lcMainDetailAttributeAttr14 = loJResp.StringOf("data[i].mainDetail.attribute.attr14")
    lcMainDetailAttributeAttr15 = loJResp.StringOf("data[i].mainDetail.attribute.attr15")
    lcMainDetailAttributeAttr16 = loJResp.StringOf("data[i].mainDetail.attribute.attr16")
    lcMainDetailAttributeAttr17 = loJResp.StringOf("data[i].mainDetail.attribute.attr17")
    lcMainDetailAttributeAttr18 = loJResp.StringOf("data[i].mainDetail.attribute.attr18")
    lcMainDetailAttributeAttr19 = loJResp.StringOf("data[i].mainDetail.attribute.attr19")
    lcMainDetailAttributeAttr20 = loJResp.StringOf("data[i].mainDetail.attribute.attr20")
    lcMainDetailAttributeApostroph = loJResp.StringOf("data[i].mainDetail.attribute.apostroph")
    i = i + 1
enddo


release loHttp
release loSbResponseBody
release loJResp