App reviews, troubleshooting, and recommendations
Hi, I am developing a shopify app and I want get store products by ids using this api call - (https://shopify.dev/docs/api/admin-rest/2024-01/resources/product#get-products?ids=632910392,9217287...).
The issue is as follows when I make the request with query parameter limit set to 250 I get only 50 products returned as a response. The thing is I can see that the limit in response is correctly set to 250, however I am only getting 50 products. Has someone ran into this issue before?
Solved! Go to the solution
This is an accepted solution.
Thanks, I am doing it that way of course, I think I found the solution you just have to specify the limit parameter in path before the product ids you want to retrieve like this:
Can I see the code you are using to make the request?
I would try and add a little bit of error handling for this issue:
/* CLIENT PROVIDER */
// ... existing code ...
/* REQUEST */
try {
let requestBody = {
path: `products.json?ids=${chunk.join(',')}`,
query: { limit: 250 }
}
let response = await client.get(requestBody);
if (response.headers && response.headers.link) {
console.log('More products available for pagination');
}
let data = response.body;
// Additional processing of data
} catch (error) {
console.error('Error fetching products:', error);
// Handle the error appropriately
}
Shopify API uses pagination for large sets of data. If the response includes a link header, it indicates that there is more data available, and you will need to make additional requests to retrieve the remaining data.
This is an accepted solution.
Thanks, I am doing it that way of course, I think I found the solution you just have to specify the limit parameter in path before the product ids you want to retrieve like this:
I would post this on the Shopify GitHub under issues and see if this might be a bug?
Just from my experience, this shouldn't normally be a thing. You should be able to still use limit if you specify it after the ids.
I don't see anything in the documentation that states that. But I could be totally wrong!
Glad you got it fixed.
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024