# Return multiple items via API

**URL:** <https://forum.bootstrapstudio.io/t/return-multiple-items-via-api/11256>\
**Category:** Reflow\
**Created:** [April 16, 2024, 11:34am UTC](https://forum.bootstrapstudio.io/t/return-multiple-items-via-api/11256 "2024-04-16T11:34:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jezjones](https://forum.bootstrapstudio.io/user_avatar/forum.bootstrapstudio.io/jezjones/32/2509_2.png) [@jezjones](https://forum.bootstrapstudio.io/u/jezjones)\
**Post date:** [April 16, 2024, 11:34am UTC](https://forum.bootstrapstudio.io/t/return-multiple-items-via-api/11256/1 "2024-04-16T11:34:40Z")

</div>

What’s the best way to call information back for a list of items from the API?  
For example, say I need the info back for just 4 items for use in a recently viewed script on the home page. I don’t want all items back as the catalogue could be large, and I don’t want to make 4 calls.  
What I’d like to do is:  
[https://api.reflowhq.com/v2/stores/](https://api.reflowhq.com/v2/stores/)/products/,,

---

<div class="post-metadata">

**Author:** ![kuligaposten](https://forum.bootstrapstudio.io/user_avatar/forum.bootstrapstudio.io/kuligaposten/32/1190_2.png) [@kuligaposten](https://forum.bootstrapstudio.io/u/kuligaposten)\
**Post date:** [April 16, 2024, 1:26pm UTC](https://forum.bootstrapstudio.io/t/return-multiple-items-via-api/11256/2 "2024-04-16T13:26:25Z")

</div>

**on your product page**  
Your product page has a search param when a user visit the product page  
get the search param product  
check if the product exist in localStorage recentlyViewed if not  
fetch the product from the reflow api  
`https://api.reflowhq.com/v2/stores/YOUR-STORE-ID/products/${product}`  
if the lenght of the recentlyViewed array \> 3 removed the oldest product  
push the product to the recentlyViewed array and store it in localStorage

**on your home page**  
get the recentlyViewed from localStorage  
for each product in the recentlyViewed array show on your recently-viewed section on your home page

if you want more persist data use indexedDB instead of localStorage. Then even when a user clear the browser your recently viewed data will persist

---

<div class="post-metadata">

**Author:** ![jezjones](https://forum.bootstrapstudio.io/user_avatar/forum.bootstrapstudio.io/jezjones/32/2509_2.png) [@jezjones](https://forum.bootstrapstudio.io/u/jezjones)\
**Post date:** [April 16, 2024, 3:27pm UTC](https://forum.bootstrapstudio.io/t/return-multiple-items-via-api/11256/3 "2024-04-16T15:27:59Z")

</div>

I hadn’t considered the localStorage option, thanks  
I have a working ‘recently viewed’ script with cookies, but now I also need stock checking, I’m also doing something similar for an ‘add to favourites’ page, so hence the need to query the API with as few calls as possible.

---

<div class="post-metadata">

**Author:** ![martin](https://forum.bootstrapstudio.io/user_avatar/forum.bootstrapstudio.io/martin/32/3_2.png) [@martin](https://forum.bootstrapstudio.io/u/martin)\
**Post date:** [April 17, 2024, 5:10pm UTC](https://forum.bootstrapstudio.io/t/return-multiple-items-via-api/11256/4 "2024-04-17T17:10:10Z")

</div>

Thank you for the feedback! After reading what you’re trying to achieve, we realized that our API doesn’t accommodate this use case very well so we added an `ids` parameter to the [get products](https://reflowhq.com/docs/api/#get-products) endpoint. You can pass a list of ids and it will return only the products that match.

---

<div class="post-metadata">

**Author:** ![jezjones](https://forum.bootstrapstudio.io/user_avatar/forum.bootstrapstudio.io/jezjones/32/2509_2.png) [@jezjones](https://forum.bootstrapstudio.io/u/jezjones)\
**Post date:** [April 17, 2024, 7:23pm UTC](https://forum.bootstrapstudio.io/t/return-multiple-items-via-api/11256/5 "2024-04-17T19:23:48Z")

</div>

That’s great thanks.  
Is there a reason why the V2 toolkit js file points to V1 of the API? I only ask as I’d also like to access the SKU, but this is only in V2

---

<div class="post-metadata">

**Author:** ![martin](https://forum.bootstrapstudio.io/user_avatar/forum.bootstrapstudio.io/martin/32/3_2.png) [@martin](https://forum.bootstrapstudio.io/u/martin)\
**Post date:** [April 18, 2024, 11:19am UTC](https://forum.bootstrapstudio.io/t/return-multiple-items-via-api/11256/6 "2024-04-18T11:19:19Z")

</div>

The toolkit and api have independent versioning. We haven’t migrated the toolkit to the new api in order to maintain compatibility with people’s integrations. A future v3 of the toolkit will use the latest api. It’s not a problem to use multiple versions of the api in your project.
