A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi,
Can I delete more than one product in one API call?
In the API document, the demo can only delete one product at a time.
DELETE /admin/api/2021-04/products/632910392.json
Hi,
There is no way to bulk delete products in shopify at this time in either the REST api or the Graphql api.
Cheers,
Gary
Hi Gary,
Thanks for the answer.
Can I ask you another question?
The rate limit is 40/40. What is the best way to maximize the API calls?
Regards,
FORZA
sure, no problem, but please accept the answer as the answer. I would suggest to use graphql for such things as generally a mutation only costs 5 so you have more bang for your buck.. Either way though you need to build your code to either inspect the response header from the rest api and when you get a status code of 429 build in a wait/retry loop, or if you use graphql inspect the cost object that comes back and do similar.
https://shopify.dev/api/usage/rate-limits
X-Shopify-Shop-Api-Call-Limit: 40/40
Retry-After: 2.0
so when you get the 429.. just wait 2 seconds and retry..
with graphQL
"extensions": {
"cost": {
"requestedQueryCost": 101,
"actualQueryCost": 46,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 954,
"restoreRate": 50
}
}
}
I compare the requested cost against the currently available and do a wait before returning so that the next call will be guaranteed to succeed.
Hope this helps
Cheers
Gary
Thanks Gary