Sample code for 30+ languages & platforms
Xbase++

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 Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL oSbResponseBody
LOCAL oJResp
LOCAL nId
LOCAL nMainDetailId
LOCAL nSupplierId
LOCAL nTaxId
LOCAL nPriceGroupId
LOCAL cFilterGroupId
LOCAL cConfiguratorSetId
LOCAL cName
LOCAL cDescription
LOCAL cDescriptionLong
LOCAL cAdded
LOCAL nActive
LOCAL nPseudoSales
LOCAL nHighlight
LOCAL cKeywords
LOCAL cMetaTitle
LOCAL cChanged
LOCAL nPriceGroupActive
LOCAL nLastStock
LOCAL nCrossBundleLook
LOCAL nNotification
LOCAL cTemplate
LOCAL nMode
LOCAL cAvailableFrom
LOCAL cAvailableTo
LOCAL nMainDetailArticleId
LOCAL nMainDetailUnitId
LOCAL cMainDetailNumber
LOCAL cMainDetailSupplierNumber
LOCAL nMainDetailKind
LOCAL cMainDetailAdditionalText
LOCAL nMainDetailActive
LOCAL nMainDetailInStock
LOCAL cMainDetailStockMin
LOCAL nMainDetailLastStock
LOCAL cMainDetailWeight
LOCAL cMainDetailWidth
LOCAL cMainDetailLen
LOCAL cMainDetailHeight
LOCAL cMainDetailEan
LOCAL cMainDetailPurchasePrice
LOCAL nMainDetailPosition
LOCAL nMainDetailMinPurchase
LOCAL nMainDetailPurchaseSteps
LOCAL nMainDetailMaxPurchase
LOCAL cMainDetailPurchaseUnit
LOCAL cMainDetailReferenceUnit
LOCAL cMainDetailPackUnit
LOCAL nMainDetailShippingFree
LOCAL cMainDetailReleaseDate
LOCAL cMainDetailShippingTime
LOCAL nMainDetailAttributeId
LOCAL nMainDetailAttributeArticleDetailId
LOCAL cMainDetailAttributeAttr1
LOCAL cMainDetailAttributeAttr2
LOCAL cMainDetailAttributeAttr3
LOCAL cMainDetailAttributeAttr4
LOCAL cMainDetailAttributeAttr5
LOCAL cMainDetailAttributeAttr6
LOCAL cMainDetailAttributeAttr7
LOCAL cMainDetailAttributeAttr8
LOCAL cMainDetailAttributeAttr9
LOCAL cMainDetailAttributeAttr10
LOCAL cMainDetailAttributeAttr11
LOCAL cMainDetailAttributeAttr12
LOCAL cMainDetailAttributeAttr13
LOCAL cMainDetailAttributeAttr14
LOCAL cMainDetailAttributeAttr15
LOCAL cMainDetailAttributeAttr16
LOCAL cMainDetailAttributeAttr17
LOCAL cMainDetailAttributeAttr18
LOCAL cMainDetailAttributeAttr19
LOCAL cMainDetailAttributeAttr20
LOCAL cMainDetailAttributeApostroph
LOCAL nTotal
LOCAL i
LOCAL nCount_i

nSuccess := 0

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

oHttp := CreateObject("Chilkat.Http")

oHttp:Login := "api_username"
oHttp:Password := "api_key"
oHttp:BasicAuth := 1

oSbResponseBody := CreateObject("Chilkat.StringBuilder")
nSuccess := oHttp:QuickGetSb("https://my-shopware-shop.com/api/articles?limit=2", oSbResponseBody)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oSbResponseBody:destroy()
    RETURN
ENDIF

oJResp := CreateObject("Chilkat.JsonObject")
oJResp:LoadSb(oSbResponseBody)
oJResp:EmitCompact := 0

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

nTotal := oJResp:IntOf("total")
nSuccess := oJResp:BoolOf("success")
i := 0
nCount_i := oJResp:SizeOfArray("data")
DO WHILE i < nCount_i
    oJResp:I := i
    nId := oJResp:IntOf("data[i].id")
    nMainDetailId := oJResp:IntOf("data[i].mainDetailId")
    nSupplierId := oJResp:IntOf("data[i].supplierId")
    nTaxId := oJResp:IntOf("data[i].taxId")
    nPriceGroupId := oJResp:IntOf("data[i].priceGroupId")
    cFilterGroupId := oJResp:StringOf("data[i].filterGroupId")
    cConfiguratorSetId := oJResp:StringOf("data[i].configuratorSetId")
    cName := oJResp:StringOf("data[i].name")
    cDescription := oJResp:StringOf("data[i].description")
    cDescriptionLong := oJResp:StringOf("data[i].descriptionLong")
    cAdded := oJResp:StringOf("data[i].added")
    nActive := oJResp:BoolOf("data[i].active")
    nPseudoSales := oJResp:IntOf("data[i].pseudoSales")
    nHighlight := oJResp:BoolOf("data[i].highlight")
    cKeywords := oJResp:StringOf("data[i].keywords")
    cMetaTitle := oJResp:StringOf("data[i].metaTitle")
    cChanged := oJResp:StringOf("data[i].changed")
    nPriceGroupActive := oJResp:BoolOf("data[i].priceGroupActive")
    nLastStock := oJResp:BoolOf("data[i].lastStock")
    nCrossBundleLook := oJResp:IntOf("data[i].crossBundleLook")
    nNotification := oJResp:BoolOf("data[i].notification")
    cTemplate := oJResp:StringOf("data[i].template")
    nMode := oJResp:IntOf("data[i].mode")
    cAvailableFrom := oJResp:StringOf("data[i].availableFrom")
    cAvailableTo := oJResp:StringOf("data[i].availableTo")
    nMainDetailId := oJResp:IntOf("data[i].mainDetail.id")
    nMainDetailArticleId := oJResp:IntOf("data[i].mainDetail.articleId")
    nMainDetailUnitId := oJResp:IntOf("data[i].mainDetail.unitId")
    cMainDetailNumber := oJResp:StringOf("data[i].mainDetail.number")
    cMainDetailSupplierNumber := oJResp:StringOf("data[i].mainDetail.supplierNumber")
    nMainDetailKind := oJResp:IntOf("data[i].mainDetail.kind")
    cMainDetailAdditionalText := oJResp:StringOf("data[i].mainDetail.additionalText")
    nMainDetailActive := oJResp:BoolOf("data[i].mainDetail.active")
    nMainDetailInStock := oJResp:IntOf("data[i].mainDetail.inStock")
    cMainDetailStockMin := oJResp:StringOf("data[i].mainDetail.stockMin")
    nMainDetailLastStock := oJResp:BoolOf("data[i].mainDetail.lastStock")
    cMainDetailWeight := oJResp:StringOf("data[i].mainDetail.weight")
    cMainDetailWidth := oJResp:StringOf("data[i].mainDetail.width")
    cMainDetailLen := oJResp:StringOf("data[i].mainDetail.len")
    cMainDetailHeight := oJResp:StringOf("data[i].mainDetail.height")
    cMainDetailEan := oJResp:StringOf("data[i].mainDetail.ean")
    cMainDetailPurchasePrice := oJResp:StringOf("data[i].mainDetail.purchasePrice")
    nMainDetailPosition := oJResp:IntOf("data[i].mainDetail.position")
    nMainDetailMinPurchase := oJResp:IntOf("data[i].mainDetail.minPurchase")
    nMainDetailPurchaseSteps := oJResp:IntOf("data[i].mainDetail.purchaseSteps")
    nMainDetailMaxPurchase := oJResp:IntOf("data[i].mainDetail.maxPurchase")
    cMainDetailPurchaseUnit := oJResp:StringOf("data[i].mainDetail.purchaseUnit")
    cMainDetailReferenceUnit := oJResp:StringOf("data[i].mainDetail.referenceUnit")
    cMainDetailPackUnit := oJResp:StringOf("data[i].mainDetail.packUnit")
    nMainDetailShippingFree := oJResp:BoolOf("data[i].mainDetail.shippingFree")
    cMainDetailReleaseDate := oJResp:StringOf("data[i].mainDetail.releaseDate")
    cMainDetailShippingTime := oJResp:StringOf("data[i].mainDetail.shippingTime")
    nMainDetailAttributeId := oJResp:IntOf("data[i].mainDetail.attribute.id")
    nMainDetailAttributeArticleDetailId := oJResp:IntOf("data[i].mainDetail.attribute.articleDetailId")
    cMainDetailAttributeAttr1 := oJResp:StringOf("data[i].mainDetail.attribute.attr1")
    cMainDetailAttributeAttr2 := oJResp:StringOf("data[i].mainDetail.attribute.attr2")
    cMainDetailAttributeAttr3 := oJResp:StringOf("data[i].mainDetail.attribute.attr3")
    cMainDetailAttributeAttr4 := oJResp:StringOf("data[i].mainDetail.attribute.attr4")
    cMainDetailAttributeAttr5 := oJResp:StringOf("data[i].mainDetail.attribute.attr5")
    cMainDetailAttributeAttr6 := oJResp:StringOf("data[i].mainDetail.attribute.attr6")
    cMainDetailAttributeAttr7 := oJResp:StringOf("data[i].mainDetail.attribute.attr7")
    cMainDetailAttributeAttr8 := oJResp:StringOf("data[i].mainDetail.attribute.attr8")
    cMainDetailAttributeAttr9 := oJResp:StringOf("data[i].mainDetail.attribute.attr9")
    cMainDetailAttributeAttr10 := oJResp:StringOf("data[i].mainDetail.attribute.attr10")
    cMainDetailAttributeAttr11 := oJResp:StringOf("data[i].mainDetail.attribute.attr11")
    cMainDetailAttributeAttr12 := oJResp:StringOf("data[i].mainDetail.attribute.attr12")
    cMainDetailAttributeAttr13 := oJResp:StringOf("data[i].mainDetail.attribute.attr13")
    cMainDetailAttributeAttr14 := oJResp:StringOf("data[i].mainDetail.attribute.attr14")
    cMainDetailAttributeAttr15 := oJResp:StringOf("data[i].mainDetail.attribute.attr15")
    cMainDetailAttributeAttr16 := oJResp:StringOf("data[i].mainDetail.attribute.attr16")
    cMainDetailAttributeAttr17 := oJResp:StringOf("data[i].mainDetail.attribute.attr17")
    cMainDetailAttributeAttr18 := oJResp:StringOf("data[i].mainDetail.attribute.attr18")
    cMainDetailAttributeAttr19 := oJResp:StringOf("data[i].mainDetail.attribute.attr19")
    cMainDetailAttributeAttr20 := oJResp:StringOf("data[i].mainDetail.attribute.attr20")
    cMainDetailAttributeApostroph := oJResp:StringOf("data[i].mainDetail.attribute.apostroph")
    i := i + 1
ENDDO

oHttp:destroy()
oSbResponseBody:destroy()
oJResp:destroy()