Testing bulk mutation in GraphIQL with - mutation bulkOperationRunMutation()

I’m a bit flummoxed by how to run a bulk mutation with the bulkOperationRunMutation() operation, for example, is it possible to bulk add collections to a store?

Are there any good working samples to point me in the right direction, the bulk operations guide does a great job explaining bulkOperationRunQuery().

I think where I’m getting hung up here is passing the mutation variable, as a string.

I have the same question and at least one more is struggling with the same method here: How-to-use-bulkOperationRunMutation.

It would be great if Shopify could add some information to the API documentation https://shopify.dev/docs/admin-api/graphql/reference/bulk-operations/bulkoperationrunmutation

or in the tutorial here https://shopify.dev/tutorials/perform-bulk-operations-with-admin-api

/Peter

2 Likes

Yeah, more information would be awesome.

I’ve tried to build the mutation by using the bulkOperationRunQuery() to get at least a test .jasonl file for the objects I want to mutate with bulkOperationRunMutation() - which was helpful. I downloaded the jasonl file the query builds, saved it, made some edits, then uploaded it to my Shopify files (just to run tests) - in hope that the bulkOperationRunMutation() would consume it. I wasn’t quite sure how the formatting should be in the jasonl file for the objects I wanted to mutate, since jasonl files treat json child objects as their own line item and have a depth/nesting limit. I guess I need an ID for each item, so perhaps I can’t do create mutations with bulk operations…

I think its still getting hung up on the mutation as string - which, I’ve come close, but it throws an error on the file when I add it to the stagedUploadPath variable. I’ll post it here - although, I think the error has more to do with syntax or the mutation string object being malformed.

I’ve probably done several things wrong here, but this is the response I get back. Maybe I can’t be lazy and test from Shopify files/cdn? Maybe my mutation string is junk. But I modified the mutation variable string until it stopped throwing errors, then I got this response on the file itself. Not even sure if I can put variables in the mutation string. The .jsonl file is a file where I modified the collection titles after I pulled all collections out of a bulk query generated file.

Did you have any luck working with this?