A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
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
Solved! Go to the solution
This is an accepted solution.
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.
This is an accepted solution.
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.