Example of POST /process-instance/suspended-async using processInstanceQuery

The current example contains just the list of process instances to be provided for suspending them, is there any example which I can use for suspending instances using processInstanceQuery?
Thanks in advance.

something like this?

import org.camunda.bpm.engine.RuntimeService
import org.camunda.bpm.engine.runtime.ProcessInstance
import java.util.List


    List<ProcessInstance> processInstances = execution.getProcessEngineServices().getRuntimeService().createProcessInstanceQuery().active().list()
    String currentInstanceId = execution.getProcessInstanceId();
    for (ProcessInstance processInstance: processInstances){
        if (currentInstanceId != processInstance.getProcessInstanceId()) {
            println "suspending processInstance with id: " + processInstance.getProcessInstanceId()
            println "process def id: " + processInstance.getProcessDefinitionId()
            execution.getProcessEngineServices().getRuntimeService().suspendProcessInstanceById(processInstance.getProcessInstanceId())
        }
    }