Hello,
We develop C# application for manage stock beetween Shopify and our ERP.
Actually, we search all product and we loop on all variants for getting article with SKU but it s very slowly
It is possible to get all product variant with SKU wihtout loop on all variant in all product ?
TY
I had/have to do something similar.
First I call a bulkOperationRunQuery to get all the products, then I call currentBulkOperations to check the status, then I get the file when the job is done.
Query to get inventory:
{“query”:“mutation GetInventory { bulkOperationRunQuery(query: "{ inventoryItems(first: 5000) { edges { node { id sku inventoryLevels(first: 10) { edges { node { available location { id } } } } } } } }") { bulkOperation { id status } userErrors { field message } } }”}
Query to check status:
{“query”:“{currentBulkOperation(type: QUERY) { id status objectCount url } }”}
This will eventually return a url where you can download a JSONL file; I just have my script wait for a second, then check, if its not ready, it waits again.
I mostly followed the Perform bulk operations with the GraphQL Admin API page; you may need to adjust the first query to better suit your needs.
1 Like