How to Suspend Process Instance by instance id

Hi All
i have one process, that have two service tasks and zero/more Call Activities that subprocess many have subprocess(callactivities),
i want to suspend a process instance using main process’s instanceid, using following code, but not suspending.

@RequestMapping(value=“suspendProcess”, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String suspendProcess(HttpServletRequest request, @RequestParam(“processInsId”) String processInsId) {
runtimeService.suspendProcessInstanceById(processInsId);
return “suspendProcess”;
}

Hi @apvenkatesan,

Can you elaborate further? Is your problem that the Process Instance with the provided ID is not suspended when the suspendProcessInstanceById method is called?

If yes, can you provide some stack trace or error log?

What are you trying to achieve? From what I can understand from your code, it seems like your trying to create a Rest API to control the engine. Have you considered using the engine’s existing Rest API?

Best,
Nikola