Development discussions around Shopify APIs
Hi! So, I tried using this on my browser: https://mystore.myshopify.com/admin/products/search.json?query=barcode:SMPLEBARCODE
It works on my browser, but when I try using it on my code, it give me a Status Code 404 NOT FOUND
I know I can filter product variants using a barcode or sku but I don't wanna go through all the products then filtering their variants until I find what I'm looking for. Say, when I have 500 or more products, it'll take a long time before I find the product variant that I want.
Can anyone help me with this?
Hi there,
The Product API does not have a search endpoint. That's why you are receiving a 404.
To find a specific variant, you'll need to fetch every product and filter from there. Storing them on your end intially and fetching occasionally to keep the records up to date would be one way to make things speedier to grab what you need after the initial sync.
That being said, if you have 500 products, only two API calls would need to be made to receive all products. The response would include variant information, which you could do whatever you need to with. I'm not sure that would qualify as a long time.
Andrew | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hi! Just one more question, let's say I have about 500,000 products. Will this affect the response time when I make a call to get all products? Or it wouldn't really make any difference if I have 5 or 500,000 products?
Hello @supspotify spotify
Did you find any solution for variant filter in product api?
I have related issue same as you.
I need something like this:
admin/products.json?fields=options[{"name" : "Size"}]
IDK if they're using ruby on the backend still, but this seems like a very useful feature (I need it also as I need to filter out a bunch of variants across many products for a particular social selling site that doesn't allow a particular variant of my product).
User | RANK |
---|---|
44 | |
16 | |
9 | |
9 | |
7 |
Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023One of the key components to running a successful online business is having clear and co...
By Ollie Mar 6, 2023