A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I have already looked at the solution here and running a script like here using the APIs:
import requests
url = 'https://{api_key}:{api_password}@corseta-republic.myshopify.com/admin/api/2022-04/orders.json?status=closed&limit=50'
response = requests.get(url.format(api_key=api_key,api_password=password))
while response.status_code == 200:
orders = response.json()
for order in orders['orders']:
print(f'deleting order {order["name"]}')
requests.delete(f"https://{api_key}:{password}@corseta-republic.myshopify.com/admin/api/2022-04/orders/{order['id']}.json")
response = requests.get(url.format(api_key=api_key,api_password=password))
print(response.status_code)
only problem is that at some point the call to 'https://{api_key}:{api_password}@corseta-republic.myshopify.com/admin/api/2022-04/orders.json?status=closed&l...' returns a 500 because there are no more archived orders.
Initially I selected everything I wanted to delete which is orders before
03/08/2022 but performing the following actions in the Shopify Admin UI:
The operation does not seem to archive everything I want it to so find myself repeatedly going to the UI archiving all and then re-running the Python script. Is there a more seamless way of achieving this? This has been going on for 3 weeks since archiving operation in the UI seems to do very little.