Tcl
Tcl
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 Tcl Downloads
load ./chilkat.dll
set success 0
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
CkHttp_put_Login $http "api_username"
CkHttp_put_Password $http "api_key"
CkHttp_put_BasicAuth $http 1
set sbResponseBody [new_CkStringBuilder]
set success [CkHttp_QuickGetSb $http "https://my-shopware-shop.com/api/articles?limit=2" $sbResponseBody]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody
exit
}
set jResp [new_CkJsonObject]
CkJsonObject_LoadSb $jResp $sbResponseBody
CkJsonObject_put_EmitCompact $jResp 0
puts "Response Body:"
puts [CkJsonObject_emit $jResp]
# 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
set total [CkJsonObject_IntOf $jResp "total"]
set success [CkJsonObject_BoolOf $jResp "success"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jResp "data"]
while {$i < $count_i} {
CkJsonObject_put_I $jResp $i
set id [CkJsonObject_IntOf $jResp "data[i].id"]
set mainDetailId [CkJsonObject_IntOf $jResp "data[i].mainDetailId"]
set supplierId [CkJsonObject_IntOf $jResp "data[i].supplierId"]
set taxId [CkJsonObject_IntOf $jResp "data[i].taxId"]
set priceGroupId [CkJsonObject_IntOf $jResp "data[i].priceGroupId"]
set filterGroupId [CkJsonObject_stringOf $jResp "data[i].filterGroupId"]
set configuratorSetId [CkJsonObject_stringOf $jResp "data[i].configuratorSetId"]
set name [CkJsonObject_stringOf $jResp "data[i].name"]
set description [CkJsonObject_stringOf $jResp "data[i].description"]
set descriptionLong [CkJsonObject_stringOf $jResp "data[i].descriptionLong"]
set added [CkJsonObject_stringOf $jResp "data[i].added"]
set active [CkJsonObject_BoolOf $jResp "data[i].active"]
set pseudoSales [CkJsonObject_IntOf $jResp "data[i].pseudoSales"]
set highlight [CkJsonObject_BoolOf $jResp "data[i].highlight"]
set keywords [CkJsonObject_stringOf $jResp "data[i].keywords"]
set metaTitle [CkJsonObject_stringOf $jResp "data[i].metaTitle"]
set changed [CkJsonObject_stringOf $jResp "data[i].changed"]
set priceGroupActive [CkJsonObject_BoolOf $jResp "data[i].priceGroupActive"]
set lastStock [CkJsonObject_BoolOf $jResp "data[i].lastStock"]
set crossBundleLook [CkJsonObject_IntOf $jResp "data[i].crossBundleLook"]
set notification [CkJsonObject_BoolOf $jResp "data[i].notification"]
set template [CkJsonObject_stringOf $jResp "data[i].template"]
set mode [CkJsonObject_IntOf $jResp "data[i].mode"]
set availableFrom [CkJsonObject_stringOf $jResp "data[i].availableFrom"]
set availableTo [CkJsonObject_stringOf $jResp "data[i].availableTo"]
set mainDetailId [CkJsonObject_IntOf $jResp "data[i].mainDetail.id"]
set mainDetailArticleId [CkJsonObject_IntOf $jResp "data[i].mainDetail.articleId"]
set mainDetailUnitId [CkJsonObject_IntOf $jResp "data[i].mainDetail.unitId"]
set mainDetailNumber [CkJsonObject_stringOf $jResp "data[i].mainDetail.number"]
set mainDetailSupplierNumber [CkJsonObject_stringOf $jResp "data[i].mainDetail.supplierNumber"]
set mainDetailKind [CkJsonObject_IntOf $jResp "data[i].mainDetail.kind"]
set mainDetailAdditionalText [CkJsonObject_stringOf $jResp "data[i].mainDetail.additionalText"]
set mainDetailActive [CkJsonObject_BoolOf $jResp "data[i].mainDetail.active"]
set mainDetailInStock [CkJsonObject_IntOf $jResp "data[i].mainDetail.inStock"]
set mainDetailStockMin [CkJsonObject_stringOf $jResp "data[i].mainDetail.stockMin"]
set mainDetailLastStock [CkJsonObject_BoolOf $jResp "data[i].mainDetail.lastStock"]
set mainDetailWeight [CkJsonObject_stringOf $jResp "data[i].mainDetail.weight"]
set mainDetailWidth [CkJsonObject_stringOf $jResp "data[i].mainDetail.width"]
set mainDetailLen [CkJsonObject_stringOf $jResp "data[i].mainDetail.len"]
set mainDetailHeight [CkJsonObject_stringOf $jResp "data[i].mainDetail.height"]
set mainDetailEan [CkJsonObject_stringOf $jResp "data[i].mainDetail.ean"]
set mainDetailPurchasePrice [CkJsonObject_stringOf $jResp "data[i].mainDetail.purchasePrice"]
set mainDetailPosition [CkJsonObject_IntOf $jResp "data[i].mainDetail.position"]
set mainDetailMinPurchase [CkJsonObject_IntOf $jResp "data[i].mainDetail.minPurchase"]
set mainDetailPurchaseSteps [CkJsonObject_IntOf $jResp "data[i].mainDetail.purchaseSteps"]
set mainDetailMaxPurchase [CkJsonObject_IntOf $jResp "data[i].mainDetail.maxPurchase"]
set mainDetailPurchaseUnit [CkJsonObject_stringOf $jResp "data[i].mainDetail.purchaseUnit"]
set mainDetailReferenceUnit [CkJsonObject_stringOf $jResp "data[i].mainDetail.referenceUnit"]
set mainDetailPackUnit [CkJsonObject_stringOf $jResp "data[i].mainDetail.packUnit"]
set mainDetailShippingFree [CkJsonObject_BoolOf $jResp "data[i].mainDetail.shippingFree"]
set mainDetailReleaseDate [CkJsonObject_stringOf $jResp "data[i].mainDetail.releaseDate"]
set mainDetailShippingTime [CkJsonObject_stringOf $jResp "data[i].mainDetail.shippingTime"]
set mainDetailAttributeId [CkJsonObject_IntOf $jResp "data[i].mainDetail.attribute.id"]
set mainDetailAttributeArticleDetailId [CkJsonObject_IntOf $jResp "data[i].mainDetail.attribute.articleDetailId"]
set mainDetailAttributeAttr1 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr1"]
set mainDetailAttributeAttr2 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr2"]
set mainDetailAttributeAttr3 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr3"]
set mainDetailAttributeAttr4 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr4"]
set mainDetailAttributeAttr5 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr5"]
set mainDetailAttributeAttr6 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr6"]
set mainDetailAttributeAttr7 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr7"]
set mainDetailAttributeAttr8 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr8"]
set mainDetailAttributeAttr9 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr9"]
set mainDetailAttributeAttr10 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr10"]
set mainDetailAttributeAttr11 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr11"]
set mainDetailAttributeAttr12 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr12"]
set mainDetailAttributeAttr13 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr13"]
set mainDetailAttributeAttr14 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr14"]
set mainDetailAttributeAttr15 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr15"]
set mainDetailAttributeAttr16 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr16"]
set mainDetailAttributeAttr17 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr17"]
set mainDetailAttributeAttr18 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr18"]
set mainDetailAttributeAttr19 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr19"]
set mainDetailAttributeAttr20 [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.attr20"]
set mainDetailAttributeApostroph [CkJsonObject_stringOf $jResp "data[i].mainDetail.attribute.apostroph"]
set i [expr $i + 1]
}
delete_CkHttp $http
delete_CkStringBuilder $sbResponseBody
delete_CkJsonObject $jResp