Deleting products via API only works for the first two products

textilmacher
Tourist
3 0 2

Hi everyone, we are trying to delete multiple products in a row via the endpoint

DELETE /admin/api/2021-04/products/[id].json

For the first two products this works just fine and we get the correct response from the server.

But for the third request the server just won't answer until we get a timeout error.

I checked the API call limit, that was not the issue.

Has anyone else experienced this?

Is this a bug or am I doing something wrong?

Regards,
Stefan

Replies 4 (4)
awwdam
Shopify Staff
179 32 18

Hey @textilmacher, would you be able to share the x-request-id response header from the first request that is presenting unexpected functionality? I would be happy to take a closer look and pass back any insights I can - Cheers!

awwdam | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

textilmacher
Tourist
3 0 2

Hi @awwdam,
the first response has the request ID "ab87f31c-107f-47d9-a6a8-b916d7b8b9f9" and the second response has "2eedae96-d8a2-4630-9566-8290f9774334".
And I don't even get the third response, that's the main problem. I simply wait very long until I get a timeout error. But the product is still deleted from the shop.
Cheers!

awwdam
Shopify Staff
179 32 18

Hey @textilmacher,

I took a closer look here, found the logs for both requests, and wanted to send an update. In both cases it appears that the initial deletion requests were submitted and received successfully, each returning a 200. I did find subsequent attempts to delete the same resources soon after, each expectedly returning 404 Not Found since the resource was already deleted.

Using those logs, I was also able to locate a third unique request from the same app to DELETE a product, however logs our end indicate this was also returned a 
200 response in an expected timeframe. At the moment if I had to guess, I'd likely lean towards potential connection issues, but wanted to ask a few more questions to see if I can't pass on additional insights.

Are you still experiencing the same issues?
Have you tested this using another app or API Client (POSTMAN)?
Do you know if there is a reason the app is making subsequent/duplicate DELETE requests to the same resource
Can you replicate this again and again? If so, can have you tested this on multiple stores (or development store).


I'll keep an eye out for a reply. and would be happy to take another look with some more info - Best! 

awwdam | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

textilmacher
Tourist
3 0 2

Hi @awwdam 
Thanks for your tip with POSTMAN!
As the requests worked in POSTMAN, I realised that it must have something to do with the way I execute these requests myself.
In the end it turned out, that I forgot to close the HTTP response stream. Now it works just fine, thanks for your help.

Regarding the 4040 Not Found requests: These didn't come from our software directly, but from the custom script I wrote to test the delete requests. There I accidently exeuted the delete request twice for the same product.

Best regards,
Stefan