Sample code for 30+ languages & platforms
DataFlex

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 DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoHttp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iId
    Integer iMainDetailId
    Integer iSupplierId
    Integer iTaxId
    Integer iPriceGroupId
    String sFilterGroupId
    String sConfiguratorSetId
    String sName
    String sDescription
    String sDescriptionLong
    String sAdded
    Boolean iActive
    Integer iPseudoSales
    Boolean iHighlight
    String sKeywords
    String sMetaTitle
    String sChanged
    Boolean iPriceGroupActive
    Boolean iLastStock
    Integer iCrossBundleLook
    Boolean iNotification
    String sTemplate
    Integer iMode
    String sAvailableFrom
    String sAvailableTo
    Integer iMainDetailArticleId
    Integer iMainDetailUnitId
    String sMainDetailNumber
    String sMainDetailSupplierNumber
    Integer iMainDetailKind
    String sMainDetailAdditionalText
    Boolean iMainDetailActive
    Integer iMainDetailInStock
    String sMainDetailStockMin
    Boolean iMainDetailLastStock
    String sMainDetailWeight
    String sMainDetailWidth
    String sMainDetailLen
    String sMainDetailHeight
    String sMainDetailEan
    String sMainDetailPurchasePrice
    Integer iMainDetailPosition
    Integer iMainDetailMinPurchase
    Integer iMainDetailPurchaseSteps
    Integer iMainDetailMaxPurchase
    String sMainDetailPurchaseUnit
    String sMainDetailReferenceUnit
    String sMainDetailPackUnit
    Boolean iMainDetailShippingFree
    String sMainDetailReleaseDate
    String sMainDetailShippingTime
    Integer iMainDetailAttributeId
    Integer iMainDetailAttributeArticleDetailId
    String sMainDetailAttributeAttr1
    String sMainDetailAttributeAttr2
    String sMainDetailAttributeAttr3
    String sMainDetailAttributeAttr4
    String sMainDetailAttributeAttr5
    String sMainDetailAttributeAttr6
    String sMainDetailAttributeAttr7
    String sMainDetailAttributeAttr8
    String sMainDetailAttributeAttr9
    String sMainDetailAttributeAttr10
    String sMainDetailAttributeAttr11
    String sMainDetailAttributeAttr12
    String sMainDetailAttributeAttr13
    String sMainDetailAttributeAttr14
    String sMainDetailAttributeAttr15
    String sMainDetailAttributeAttr16
    String sMainDetailAttributeAttr17
    String sMainDetailAttributeAttr18
    String sMainDetailAttributeAttr19
    String sMainDetailAttributeAttr20
    String sMainDetailAttributeApostroph
    Integer iTotal
    Integer i
    Integer iCount_i
    String sTemp1

    Move False To iSuccess

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Set ComLogin Of hoHttp To "api_username"
    Set ComPassword Of hoHttp To "api_key"
    Set ComBasicAuth Of hoHttp To True

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://my-shopware-shop.com/api/articles?limit=2" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    // 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

    Get ComIntOf Of hoJResp "total" To iTotal
    Get ComBoolOf Of hoJResp "success" To iSuccess
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "data" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComIntOf Of hoJResp "data[i].id" To iId
        Get ComIntOf Of hoJResp "data[i].mainDetailId" To iMainDetailId
        Get ComIntOf Of hoJResp "data[i].supplierId" To iSupplierId
        Get ComIntOf Of hoJResp "data[i].taxId" To iTaxId
        Get ComIntOf Of hoJResp "data[i].priceGroupId" To iPriceGroupId
        Get ComStringOf Of hoJResp "data[i].filterGroupId" To sFilterGroupId
        Get ComStringOf Of hoJResp "data[i].configuratorSetId" To sConfiguratorSetId
        Get ComStringOf Of hoJResp "data[i].name" To sName
        Get ComStringOf Of hoJResp "data[i].description" To sDescription
        Get ComStringOf Of hoJResp "data[i].descriptionLong" To sDescriptionLong
        Get ComStringOf Of hoJResp "data[i].added" To sAdded
        Get ComBoolOf Of hoJResp "data[i].active" To iActive
        Get ComIntOf Of hoJResp "data[i].pseudoSales" To iPseudoSales
        Get ComBoolOf Of hoJResp "data[i].highlight" To iHighlight
        Get ComStringOf Of hoJResp "data[i].keywords" To sKeywords
        Get ComStringOf Of hoJResp "data[i].metaTitle" To sMetaTitle
        Get ComStringOf Of hoJResp "data[i].changed" To sChanged
        Get ComBoolOf Of hoJResp "data[i].priceGroupActive" To iPriceGroupActive
        Get ComBoolOf Of hoJResp "data[i].lastStock" To iLastStock
        Get ComIntOf Of hoJResp "data[i].crossBundleLook" To iCrossBundleLook
        Get ComBoolOf Of hoJResp "data[i].notification" To iNotification
        Get ComStringOf Of hoJResp "data[i].template" To sTemplate
        Get ComIntOf Of hoJResp "data[i].mode" To iMode
        Get ComStringOf Of hoJResp "data[i].availableFrom" To sAvailableFrom
        Get ComStringOf Of hoJResp "data[i].availableTo" To sAvailableTo
        Get ComIntOf Of hoJResp "data[i].mainDetail.id" To iMainDetailId
        Get ComIntOf Of hoJResp "data[i].mainDetail.articleId" To iMainDetailArticleId
        Get ComIntOf Of hoJResp "data[i].mainDetail.unitId" To iMainDetailUnitId
        Get ComStringOf Of hoJResp "data[i].mainDetail.number" To sMainDetailNumber
        Get ComStringOf Of hoJResp "data[i].mainDetail.supplierNumber" To sMainDetailSupplierNumber
        Get ComIntOf Of hoJResp "data[i].mainDetail.kind" To iMainDetailKind
        Get ComStringOf Of hoJResp "data[i].mainDetail.additionalText" To sMainDetailAdditionalText
        Get ComBoolOf Of hoJResp "data[i].mainDetail.active" To iMainDetailActive
        Get ComIntOf Of hoJResp "data[i].mainDetail.inStock" To iMainDetailInStock
        Get ComStringOf Of hoJResp "data[i].mainDetail.stockMin" To sMainDetailStockMin
        Get ComBoolOf Of hoJResp "data[i].mainDetail.lastStock" To iMainDetailLastStock
        Get ComStringOf Of hoJResp "data[i].mainDetail.weight" To sMainDetailWeight
        Get ComStringOf Of hoJResp "data[i].mainDetail.width" To sMainDetailWidth
        Get ComStringOf Of hoJResp "data[i].mainDetail.len" To sMainDetailLen
        Get ComStringOf Of hoJResp "data[i].mainDetail.height" To sMainDetailHeight
        Get ComStringOf Of hoJResp "data[i].mainDetail.ean" To sMainDetailEan
        Get ComStringOf Of hoJResp "data[i].mainDetail.purchasePrice" To sMainDetailPurchasePrice
        Get ComIntOf Of hoJResp "data[i].mainDetail.position" To iMainDetailPosition
        Get ComIntOf Of hoJResp "data[i].mainDetail.minPurchase" To iMainDetailMinPurchase
        Get ComIntOf Of hoJResp "data[i].mainDetail.purchaseSteps" To iMainDetailPurchaseSteps
        Get ComIntOf Of hoJResp "data[i].mainDetail.maxPurchase" To iMainDetailMaxPurchase
        Get ComStringOf Of hoJResp "data[i].mainDetail.purchaseUnit" To sMainDetailPurchaseUnit
        Get ComStringOf Of hoJResp "data[i].mainDetail.referenceUnit" To sMainDetailReferenceUnit
        Get ComStringOf Of hoJResp "data[i].mainDetail.packUnit" To sMainDetailPackUnit
        Get ComBoolOf Of hoJResp "data[i].mainDetail.shippingFree" To iMainDetailShippingFree
        Get ComStringOf Of hoJResp "data[i].mainDetail.releaseDate" To sMainDetailReleaseDate
        Get ComStringOf Of hoJResp "data[i].mainDetail.shippingTime" To sMainDetailShippingTime
        Get ComIntOf Of hoJResp "data[i].mainDetail.attribute.id" To iMainDetailAttributeId
        Get ComIntOf Of hoJResp "data[i].mainDetail.attribute.articleDetailId" To iMainDetailAttributeArticleDetailId
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr1" To sMainDetailAttributeAttr1
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr2" To sMainDetailAttributeAttr2
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr3" To sMainDetailAttributeAttr3
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr4" To sMainDetailAttributeAttr4
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr5" To sMainDetailAttributeAttr5
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr6" To sMainDetailAttributeAttr6
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr7" To sMainDetailAttributeAttr7
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr8" To sMainDetailAttributeAttr8
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr9" To sMainDetailAttributeAttr9
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr10" To sMainDetailAttributeAttr10
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr11" To sMainDetailAttributeAttr11
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr12" To sMainDetailAttributeAttr12
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr13" To sMainDetailAttributeAttr13
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr14" To sMainDetailAttributeAttr14
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr15" To sMainDetailAttributeAttr15
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr16" To sMainDetailAttributeAttr16
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr17" To sMainDetailAttributeAttr17
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr18" To sMainDetailAttributeAttr18
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr19" To sMainDetailAttributeAttr19
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.attr20" To sMainDetailAttributeAttr20
        Get ComStringOf Of hoJResp "data[i].mainDetail.attribute.apostroph" To sMainDetailAttributeApostroph
        Move (i + 1) To i
    Loop



End_Procedure