Create a variable with specific values received from an external api call
![pachocastillosr](https://us.v-cdn.net/6037124/uploads/userpics/MC7ELS8NG1HC/nPLP98RNMYYEZ.jpg)
Hi,
I am getting the following response from Meta catalog, describing a list of products. The response per product looks like something like this:
{
"data": [
{
"name": "Shoe",
"retailer_id": "123gffj",
"availability": "in stock",
"description": "Test description.",
"color": "Red",
"material": "Cotton",
"pattern": "Stripes",
"sale_price": "$ 32,000",
"currency": "COP",
"gender": "unisex",
"age_group": "adult",
"id": "6026848224036348"
}
For each product, I have to create a variable with only the name, description and color of the product. For this sample would look like this:
Name: Shoe, Description: Test description., Color: Red
This is what I'm trying:
Now I have no clue on what to do here to create the "Name: Shoe, Description: Test description., Color: Red" variable:
Any help would be appreciated, thanks!
Best Answer
-
Use the stop and debug function in xano inside your for-each loom to see what variant contains. That will help you make smart decisions about how to extract the data you want. When you see a member (e.g. variant contains a path called "name", you can set variable name to value variant.name
This dot syntax (akin but not exactly like JSON Path) lets you move a lot faster in xano.
Answers
-
I've added the "For each loop" action:
But I'm stuck here:
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback