Testing a mutation without making changes?

Hi!

I was wondering if there is a way to “test” a mutation without actually having it make changes. I’m thinking of something analogous to the “analyze” argument that can be used with queries.

Thanks!

Hi Jeremy
The analyze argument for queries is there to let you know the complexity of the query in regards to credits without running it. What is it about the mutation that you would be looking for?

Hi Theresa,

Honestly, I’m not 100% sure. :sweat_smile: I guess I was kind of thinking how if you use the analyze:true flag in a query, you can use it to see if a query is syntactically correct (all the fields exist, the structure is good, etc) without returning a result. Also, as you said, it’s useful to see how many credits a query will use before actually running it. In a way, it’s a way of doing a test run to see if you’ll be able to get back a good result, depending, of course, on if your criteria is correct.

I’m just kind of thinking out loud here, but on the mutation side I was thinking of something similar. I don’t think there are credits to measure out on the mutation side, but it would be nice to be able to test to see if the mutation is syntactically correct. Ideally, it would be great if this “analyze analog” could also tell you if your mutation would be successful at whatever you’re trying to do. For example, if I’m putting together a mutation to delete a product, and I supply it with a SKU, the flag could test the mutation and cause it to see if the SKU would be successfully deleted without actually deleting it. But I guess doing that would be a step beyond what the analyze flag is doing, because if I pull a product query for a SKU with the analyze flag, it’s not going to tell me the accuracy of the criteria. It’s just going to let me know that my query is syntactically correct and how many credits it’s going to cost me.

Hi Jeremy,

There is not a way to analyze a mutation for accuracy. You should get back an error if it is not successful. The “analyze” for a query is just to tell you how many credits the query will use when you run it.

Hi Theresa,

I understand that I’ll get back an error if it’s not successful, but when doing script testing, I don’t want to actually delete anything yet because there are other steps in the script that need to be fleshed out. If I delete anything now while I’m testing earlier parts of the script, the chain reaction of events I’m trying to automate will never happen once the script is done because those SKUs will be gone. That’s why I was asking about a flag.

You could setup a sandbox account