Rust
Rust
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 Rust Downloads
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = chilkat::Http::new();
http.set_login("api_username");
http.set_password("api_key");
http.set_basic_auth(true);
let sb_response_body = chilkat::StringBuilder::new();
if http.quick_get_sb("https://my-shopware-shop.com/api/articles?limit=2", &sb_response_body).is_err() {
println!("{}", http.last_error_text());
return;
}
let j_resp = chilkat::JsonObject::new();
let _ = j_resp.load_sb(&sb_response_body);
j_resp.set_emit_compact(false);
println!("Response Body:");
println!("{}", j_resp.emit().unwrap_or_default());
// 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
let total = j_resp.int_of("total");
let _ = j_resp.bool_of("success");
let mut i = 0;
let count_i = j_resp.size_of_array("data");
while i < count_i {
j_resp.set_i(i);
let _ = j_resp.int_of("data[i].id");
let _ = j_resp.int_of("data[i].mainDetailId");
let _ = j_resp.int_of("data[i].supplierId");
let _ = j_resp.int_of("data[i].taxId");
let _ = j_resp.int_of("data[i].priceGroupId");
let _ = j_resp.string_of("data[i].filterGroupId").unwrap_or_default();
let _ = j_resp.string_of("data[i].configuratorSetId").unwrap_or_default();
let _ = j_resp.string_of("data[i].name").unwrap_or_default();
let _ = j_resp.string_of("data[i].description").unwrap_or_default();
let _ = j_resp.string_of("data[i].descriptionLong").unwrap_or_default();
let _ = j_resp.string_of("data[i].added").unwrap_or_default();
let _ = j_resp.bool_of("data[i].active");
let _ = j_resp.int_of("data[i].pseudoSales");
let _ = j_resp.bool_of("data[i].highlight");
let _ = j_resp.string_of("data[i].keywords").unwrap_or_default();
let _ = j_resp.string_of("data[i].metaTitle").unwrap_or_default();
let _ = j_resp.string_of("data[i].changed").unwrap_or_default();
let _ = j_resp.bool_of("data[i].priceGroupActive");
let _ = j_resp.bool_of("data[i].lastStock");
let _ = j_resp.int_of("data[i].crossBundleLook");
let _ = j_resp.bool_of("data[i].notification");
let _ = j_resp.string_of("data[i].template").unwrap_or_default();
let _ = j_resp.int_of("data[i].mode");
let _ = j_resp.string_of("data[i].availableFrom").unwrap_or_default();
let _ = j_resp.string_of("data[i].availableTo").unwrap_or_default();
let _ = j_resp.int_of("data[i].mainDetail.id");
let _ = j_resp.int_of("data[i].mainDetail.articleId");
let _ = j_resp.int_of("data[i].mainDetail.unitId");
let _ = j_resp.string_of("data[i].mainDetail.number").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.supplierNumber").unwrap_or_default();
let _ = j_resp.int_of("data[i].mainDetail.kind");
let _ = j_resp.string_of("data[i].mainDetail.additionalText").unwrap_or_default();
let _ = j_resp.bool_of("data[i].mainDetail.active");
let _ = j_resp.int_of("data[i].mainDetail.inStock");
let _ = j_resp.string_of("data[i].mainDetail.stockMin").unwrap_or_default();
let _ = j_resp.bool_of("data[i].mainDetail.lastStock");
let _ = j_resp.string_of("data[i].mainDetail.weight").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.width").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.len").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.height").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.ean").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.purchasePrice").unwrap_or_default();
let _ = j_resp.int_of("data[i].mainDetail.position");
let _ = j_resp.int_of("data[i].mainDetail.minPurchase");
let _ = j_resp.int_of("data[i].mainDetail.purchaseSteps");
let _ = j_resp.int_of("data[i].mainDetail.maxPurchase");
let _ = j_resp.string_of("data[i].mainDetail.purchaseUnit").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.referenceUnit").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.packUnit").unwrap_or_default();
let _ = j_resp.bool_of("data[i].mainDetail.shippingFree");
let _ = j_resp.string_of("data[i].mainDetail.releaseDate").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.shippingTime").unwrap_or_default();
let _ = j_resp.int_of("data[i].mainDetail.attribute.id");
let _ = j_resp.int_of("data[i].mainDetail.attribute.articleDetailId");
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr1").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr2").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr3").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr4").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr5").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr6").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr7").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr8").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr9").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr10").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr11").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr12").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr13").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr14").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr15").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr16").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr17").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr18").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr19").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.attr20").unwrap_or_default();
let _ = j_resp.string_of("data[i].mainDetail.attribute.apostroph").unwrap_or_default();
i = i + 1;
}