bulkOperationRunQuery and injecting a needed ID

Shopify Expert
4370 36 463

To do a bulk operation like "Download all the products in this collection", where that collection has an ID, it is trivial if you paste in the GID of the collection to the query, but in a dynamic environment where that ID could change per shop, how do you run the bulk query by introducing a variable like ID? Nothing I have tried in Insomnia works. So I am curious. What is the secret sauce to injecting some variability to a bulkOperationRunQuery?



Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
Shopify Staff
Shopify Staff
750 86 164

Hey @HunkyBill,

I haven't been able to get this working in Insomnia either, but I think this has to do with Insomnia not playing nice with the syntax used to create a BulkOperation job. It doesn't seem to recognize the syntax for a regular bulkOperation, even though that query completes as expected. Outside of Insomnia you can consider storing the collection_id in a variable, and build your queries on the fly by interpolating in the id.

Insomnia is my daily driver as well and I'd also like to see this working in there. I'll try to find out if they have plans to support this syntax moving forward and report back here if I find anything.

JB | Developer 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