How to update multiple records in Xano with an external API

Hello everyone I hope that you’re fine :smiley:
I’m super new in Weweb and I’m facing some issues, I have a database in Xano with a list of Amazon products, which contains various information such as the name, price, images, and ASIN as you can see in the image.

What I’m trying to do is to update the price via an external API that allows sending up to 10 products per request using each product’s ASIN.

To achieve this, I’m creating a workflow that

  1. Fetch the product list from Xano
  2. Modifies a variable to update the ASIN list from the current product list
  3. Fetch the new data from the API that contains a new value eg: price

Up to this point, everything works perfectly. The API request is successful and returns the same list of ASINs that I provided, now with the most recent product information, as you can see in the image.

My problem is that I don’t know how to implement a logic in WeWeb that would allow me to update a field (like the price) for each product. For instance, let’s say that the ASIN B0BTN8NB7S has a price of 44.99 in Xano, but the API request returns a new price of 34.99. What I would like to achieve is to have this new price updated in Xano. So far, I’ve tried various things, but I haven’t managed to get it to work, as different prices always end up being updated for the ASIN, or the same price defaults to all products. If anyone has an idea or any documentation on how to achieve this, it would be fantastic. I hope I’ve made myself clear, and thank you in advance for reading all of this!

Hello, did your try to use a “for each” implementation?

however, the way you describe your need, I think you should maybe do this call chaining and update directly from Xano rather than using weweb as an orchestrator. This looks more like business logic to me rather than display logic

2 Likes

Hi there! thanks for the answer. Yes! I finally achieve it with the for loop action. However, as you said it’s probably better using Xano directly. Do you have any doc or video that I can watch to understand how to do it? :thinking:

1 Like

May be that video can help you: (1) Xano - Boucles - YouTube