HTTP Put a value into a collection's item, inside an array

Hi!
I’m on my second day of fighting with one part of a scenario, that updates product’s attributes between two systems. I’m doing an HTTP get request to retrieve given product’s data structure and values, then want to update certain fields within that structure with an HTTP Put request. This is the part of http get output bundle that i’m working with:

In the PUT request, i’m using this as the key: description[4].content
In an attempt to update value, that is underlined in red on the screenshot.

However, every time i try this out, the value that actually gets updates is underlined in blue, which i dont want to change. Changing the number between quare brackets in the key , doesnt seem to alter this behavior in any way.

My question is, what am i missing? how to target this specific field, that is inside a collection, inside an array?

1 Like

Hey Artur,

can you show a screenshot of the module setup and how you are mapping this?

Hey, of course - here it is:

1 Like

That’s just a string, it will try and look for an item whos key matches that string. Is that supposed to be datacell_id 20? Try and check the documentation of the API you are trying to call and how you need to structure your API call to change it.

Yes, it’s supposed to update “content” in datacell_id 20, below i’ve pasted the full example from api’s documentation, i’m interested in “descriptions:…” part. I just dont know how to write the key in make’s input field. Simple values work fine when entering the key as text, but for arrays there may be another method - but i couldn’t find anything online :frowning:

{
“title”: “Produkt testowy”,
“catalog”: “1VWOCN48”,
“ean”: “7501031311309”,
“symbol”: “SYM123”,
“location”: “PS-32-3”,
“quantity”: 5,
“weight”: 1.5,
“as_set”: false,
“volume”: 1,
“no_barcode_label”: 1,
“price”: 153.22,
“price_promo”: 72.22,
“price_buy”: 153.22,
“promotion”: 1,
“presale_date”: “2023-04-13 12:00:59”,
“vat”: 23,
“status”: 1,
“category_id”: 1,
“variants_group_id”: 1,
“unit_id”: 1,
“availability_id”: 1,
“shipment_template_id”: 1,
“priority”: 1,
“step”: 0.001,
“alert”: 3,
“extra_info”: “Dodatkowe informacje”,
“bestseller”: 0,
“new”: 1,
“manufacturer_id”: 1,
“description”: “Spodnie sztruksowe zielone, bardzo ładne”,
“responsibleperson_id”: 123,
“description_short”: “Fajne spodnie”,
“descriptions”: [
{
“datacell_id”: 21,
“content”: “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vulputate condimentum mi eu bibendum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.”
}
],
“meta”: {
“title”: “Meta tytuł”,
“keywords”: “Meta słowa kluczowe”,
“description”: “Meta description”
},
“images”: [
https://sellingo.pl/public/themes/default/images/logo.png”,
https://sellingo.pl/public/themes/default/images/logo.png”,
https://sellingo.pl/public/themes/default/images/logo.png
],
“categories”: [
5,
19,
24
],
“storages”: [
{
“id”: 1,
“storage_id”: 341,
“product_variant_id”: 7691,
“quantity”: 1,
“rack_id”: 232,
“shelf_id”: 1
}
],
“suppliers”: [
{
“quantity”: 1,
“supplier_id”: 5
}
],
“pricesfieldsvalues”: [
{
“id”: 1,
“pricesfield_id”: 2,
“value”: 21.9
}
],
“shops_settings”: [
{
“shop_id”: 1,
“price”: 33.99,
“price_promo”: 19.99,
“promotion”: 1,
“promotion_end”: “2023-04-13 12:00:59”
}
],
“additional_fields”: [
{
“field_id”: 1,
“field_name”: “pole_tekstowe”,
“field_value”: “wartość pola”
},
{
“field_id”: 3,
“field_name”: “checkbox”,
“field_value”: “tak”
},
{
“field_id”: 3,
“field_name”: “checkbox”,
“field_value”: “nie”
},
{
“field_id”: 4,
“field_name”: “Dodatkowe pliki”,
“field_value”: “base64”
}
],
“external_offers_settings”: [
{
“offer_id”: 8,
“external_account_id”: 2,
“price”: 52.99,
“price_promo”: 42.99,
“promotion”: 1,
“promotion_end”: “2023-04-13 12:00:59”
}
],
“external_shops_mappings”: [
{
“shop_id”: 8,
“foreign_id”: 2
}
]
}

You can try with the key being descriptions and the value being:

{
“datacell_id”: 22,
“content”: “whatever your content is goes here”
}

Or yo can prepare the array with a Create a JSON module before that and map it as the value.

Thank you! creating JSON and mapping it to the request worked. Screenshot for others searching for solution: