Awesome! We are almost there. Tchnicaly, this is what I need: storing just that little piece of info.
However, currentlly it stores that value just once, so I am not sure from which product it pulled that information.
In my response, I have 10 different products, so I need to make sure it looks for that “Marke” through every single product and stores that value just for the current product. Here is the screenshot how my results are looking
I think the best is to share the complete response and the test script with you, so you can run that from your side, but since there is a character limit here, I will do just 2 products.
So, this is the response which contains 2 products:
[
{
"sku": "91357",
"name": "Schaukelset mit 5 Sitzen Orange",
"permalink": "https://shopnetic.de/spielzeuge-spiele/spielzeug-fuer-draussen/spieltuerme/schaukelset-mit-5-sitzen-orange/",
"regular_price": "235.03",
"stock_quantity": 123,
"categories": [
{
"id": 22038,
"name": "Spieltürme",
"slug": "spieltuerme"
}
],
"attributes": [
{
"id": 54,
"name": "Farbe",
"position": 1,
"visible": true,
"variation": false,
"options": [
"Orange"
]
},
{
"id": 55,
"name": "Geschlecht",
"position": 2,
"visible": true,
"variation": false,
"options": [
"Kinder"
]
},
{
"id": 58,
"name": "Marke",
"position": 5,
"visible": true,
"variation": false,
"options": [
"vidaXL"
]
},
{
"id": 59,
"name": "Art der Pakete",
"position": 6,
"visible": true,
"variation": false,
"options": [
"parcel"
]
},
{
"id": 60,
"name": "Anzahl der Packstücke",
"position": 7,
"visible": true,
"variation": false,
"options": [
"1"
]
}
],
"meta_data": [
{
"id": 69383907,
"key": "_alg_wc_cog_profit",
"value": "197.504202"
},
{
"id": 69383908,
"key": "_alg_wc_cog_profit_percent",
"value": "0"
},
{
"id": 69383909,
"key": "_alg_wc_cog_profit_margin",
"value": "100"
},
{
"id": 69383929,
"key": "fifu_list_url",
"value": "https://vdxl.im/8718475571131_a_en_hd_1.jpg|https://vdxl.im/8718475571131_g_en_hd_1.jpg|https://vdxl.im/8718475571131_g_en_hd_2.jpg|https://vdxl.im/8718475571131_g_en_hd_3.jpg|https://vdxl.im/8718475571131_g_en_hd_4.jpg|https://vdxl.im/8718475571131_g_en_hd_5.jpg|https://vdxl.im/8718475571131_g_en_hd_6.jpg|https://vdxl.im/8718475571131_g_en_hd_7.jpg|https://vdxl.im/8718475571131_g_en_hd_8.jpg|https://vdxl.im/8718475571131_g_en_hd_9.jpg|https://vdxl.im/8718475571131_g_en_hd_10.jpg|https://vdxl.im/8718475571131_g_en_hd_11.jpg"
},
{
"id": 69383930,
"key": "fifu_list_alt",
"value": "Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange|Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383931,
"key": "fifu_image_url",
"value": "https://vdxl.im/8718475571131_a_en_hd_1.jpg"
},
{
"id": 69383932,
"key": "fifu_image_alt",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383933,
"key": "fifu_image_url_0",
"value": "https://vdxl.im/8718475571131_g_en_hd_1.jpg"
},
{
"id": 69383934,
"key": "fifu_image_alt_0",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383935,
"key": "fifu_image_url_1",
"value": "https://vdxl.im/8718475571131_g_en_hd_2.jpg"
},
{
"id": 69383936,
"key": "fifu_image_alt_1",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383937,
"key": "fifu_image_url_2",
"value": "https://vdxl.im/8718475571131_g_en_hd_3.jpg"
},
{
"id": 69383938,
"key": "fifu_image_alt_2",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383939,
"key": "fifu_image_url_3",
"value": "https://vdxl.im/8718475571131_g_en_hd_4.jpg"
},
{
"id": 69383940,
"key": "fifu_image_alt_3",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383941,
"key": "fifu_image_url_4",
"value": "https://vdxl.im/8718475571131_g_en_hd_5.jpg"
},
{
"id": 69383942,
"key": "fifu_image_alt_4",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383943,
"key": "fifu_image_url_5",
"value": "https://vdxl.im/8718475571131_g_en_hd_6.jpg"
},
{
"id": 69383944,
"key": "fifu_image_alt_5",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383945,
"key": "fifu_image_url_6",
"value": "https://vdxl.im/8718475571131_g_en_hd_7.jpg"
},
{
"id": 69383946,
"key": "fifu_image_alt_6",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383947,
"key": "fifu_image_url_7",
"value": "https://vdxl.im/8718475571131_g_en_hd_8.jpg"
},
{
"id": 69383948,
"key": "fifu_image_alt_7",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383949,
"key": "fifu_image_url_8",
"value": "https://vdxl.im/8718475571131_g_en_hd_9.jpg"
},
{
"id": 69383950,
"key": "fifu_image_alt_8",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383951,
"key": "fifu_image_url_9",
"value": "https://vdxl.im/8718475571131_g_en_hd_10.jpg"
},
{
"id": 69383952,
"key": "fifu_image_alt_9",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383953,
"key": "fifu_image_url_10",
"value": "https://vdxl.im/8718475571131_g_en_hd_11.jpg"
},
{
"id": 69383954,
"key": "fifu_image_alt_10",
"value": "Schaukelset mit 5 Sitzen Orange"
},
{
"id": 69383955,
"key": "_rank_math_gtin_code",
"value": "8718475571131"
},
{
"id": 69383956,
"key": "_alg_wc_cog_cost",
"value": "145.98"
},
{
"id": 69383957,
"key": "_wp_page_template",
"value": "default"
},
{
"id": 69383958,
"key": "rank_math_internal_links_processed",
"value": "1"
},
{
"id": 69483263,
"key": "fifu_tmp_product_image_gallery",
"value": "10633985,10633986,10633987,10633988,10633989,10633990,10633991,10633992,10633993,10633994,10633995"
}
],
"delivery_time": {
"name": "3–6 Werktage"
}
},
{
"sku": "809515",
"name": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte",
"permalink": "https://shopnetic.de/moebel/tische/nachttische/nachttische-2-stk-schwarz-45x34x44-cm-spanplatte/",
"regular_price": "63.98",
"stock_quantity": 140,
"categories": [
{
"id": 21525,
"name": "Nachttische",
"slug": "nachttische"
}
],
"attributes": [
{
"id": 54,
"name": "Farbe",
"position": 1,
"visible": true,
"variation": false,
"options": [
"Schwarz"
]
},
{
"id": 57,
"name": "Größe",
"position": 4,
"visible": true,
"variation": false,
"options": [
"N/A"
]
},
{
"id": 58,
"name": "Marke",
"position": 5,
"visible": true,
"variation": false,
"options": [
"vidaXL"
]
},
{
"id": 59,
"name": "Art der Pakete",
"position": 6,
"visible": true,
"variation": false,
"options": [
"parcel"
]
},
{
"id": 60,
"name": "Anzahl der Packstücke",
"position": 7,
"visible": true,
"variation": false,
"options": [
"1"
]
}
],
"meta_data": [
{
"id": 69278794,
"key": "_alg_wc_cog_profit",
"value": "53.764706"
},
{
"id": 69278795,
"key": "_alg_wc_cog_profit_percent",
"value": "0"
},
{
"id": 69278796,
"key": "_alg_wc_cog_profit_margin",
"value": "100"
},
{
"id": 69278816,
"key": "fifu_list_url",
"value": "https://vdxl.im/8720286834527_m_en_hd_1.jpg|https://vdxl.im/8720286834527_a_en_hd_1.jpg|https://vdxl.im/8720286834527_g_en_hd_1.jpg|https://vdxl.im/8720286834527_g_en_hd_2.jpg|https://vdxl.im/8720286834527_g_en_hd_3.jpg|https://vdxl.im/8720286834527_g_en_hd_4.jpg|https://vdxl.im/8720286834527_g_en_hd_5.jpg|https://vdxl.im/8720286834527_g_en_hd_6.jpg|https://vdxl.im/8720286834527_g_en_hd_7.jpg|||"
},
{
"id": 69278817,
"key": "fifu_list_alt",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte|Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278818,
"key": "fifu_image_url",
"value": "https://vdxl.im/8720286834527_m_en_hd_1.jpg"
},
{
"id": 69278819,
"key": "fifu_image_alt",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278820,
"key": "fifu_image_url_0",
"value": "https://vdxl.im/8720286834527_a_en_hd_1.jpg"
},
{
"id": 69278821,
"key": "fifu_image_alt_0",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278822,
"key": "fifu_image_url_1",
"value": "https://vdxl.im/8720286834527_g_en_hd_1.jpg"
},
{
"id": 69278823,
"key": "fifu_image_alt_1",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278824,
"key": "fifu_image_url_2",
"value": "https://vdxl.im/8720286834527_g_en_hd_2.jpg"
},
{
"id": 69278825,
"key": "fifu_image_alt_2",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278826,
"key": "fifu_image_url_3",
"value": "https://vdxl.im/8720286834527_g_en_hd_3.jpg"
},
{
"id": 69278827,
"key": "fifu_image_alt_3",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278828,
"key": "fifu_image_url_4",
"value": "https://vdxl.im/8720286834527_g_en_hd_4.jpg"
},
{
"id": 69278829,
"key": "fifu_image_alt_4",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278830,
"key": "fifu_image_url_5",
"value": "https://vdxl.im/8720286834527_g_en_hd_5.jpg"
},
{
"id": 69278831,
"key": "fifu_image_alt_5",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278832,
"key": "fifu_image_url_6",
"value": "https://vdxl.im/8720286834527_g_en_hd_6.jpg"
},
{
"id": 69278833,
"key": "fifu_image_alt_6",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278834,
"key": "fifu_image_url_7",
"value": "https://vdxl.im/8720286834527_g_en_hd_7.jpg"
},
{
"id": 69278835,
"key": "fifu_image_alt_7",
"value": "Nachttische 2 Stk. Schwarz 45x34x44 cm Spanplatte"
},
{
"id": 69278836,
"key": "_rank_math_gtin_code",
"value": "8720286834527"
},
{
"id": 69278837,
"key": "_alg_wc_cog_cost",
"value": "39.74"
},
{
"id": 69278838,
"key": "_wp_page_template",
"value": "default"
},
{
"id": 69278839,
"key": "rank_math_internal_links_processed",
"value": "1"
}
],
"delivery_time": {
"name": "3–6 Werktage"
}
},
]
And this is the test script:
const response = pm.response.json();
const sku = response.map(data => data.sku);
console.log(sku);
const title = response.map(data => data.name);
console.log(title);
const price = response.map(data => data.regular_price);
console.log(price);
const url = response.map(data => data.permalink);
console.log(url);
const delivery = response.map(data => data.delivery_time.name);
console.log(delivery);
const checkoutLimitPerPeriod = response.map(data => data.stock_quantity);
console.log(checkoutLimitPerPeriod);
const categoryPath = response.map(data => data.categories[0].name);
console.log(categoryPath);
//Loop through all items
for (let x = 0; x < response[0].attributes.length; x++) {
//Check if name is Marke
if (response[0].attributes[x].name === "Marke"){
//If true then do something
console.log(response[0].attributes[x].options[0]);
}
}
pm.variables.set('skus4idealo', sku);
pm.variables.set('titles4idealo', title);
pm.variables.set('prices4idealo', price);
pm.variables.set('urls4idealo', url);
pm.variables.set('delivery4idealo', delivery);
pm.variables.set('category4idealo', categoryPath);
pm.variables.set('stock4idealo', checkoutLimitPerPeriod);