This topic was automatically generated from Slack. You can find the original thread here.
Hendry Tromp : Hello, I have a workflow on a schedule (every 5 min) ->http request to pol data and then -> http put request to update product to in ecwid. Successfully it updated 1 product in ecwid, my question is what do I have to do to update all the products? Do I need to add more value [0],[1] in the url?
Dylan Sather (Pipedream) : just to confirm, when you make the first HTTP request, does that return a list of products? And then are you intending to run the PUT request on each of those products?
In that example, I’m just looping through an array of numbers:
for (const num of [1, 2, 3]) {
but in your case, you’d want to do something like:
const axios = require("axios");
// We'll store each response and return them in this array
const responses = [];
// Replace steps.get_products.$return_value with the variable corresponding to your array of products
for (const product of steps.get_products.$return_value) {
const resp = await axios({
method: "PUT",
url: params.url,
data: {
// your key-value pairs of data to send in the PUT request
},
});
responses.push(resp.data);
}
return responses;
You’ll have to modify that example to your specific use case, but let me know if that helps