Activate and Suspend a process instance via rest

111 views
Skip to first unread message

Clint Manning

unread,
Aug 7, 2013, 8:37:03 AM8/7/13
to camunda...@googlegroups.com
Hi,

  We have a requirement to activate and suspend a process instance via the Rest API. I couldn't see it specified in the documentation. Would camunda be interested in such an addition?
 
  Proposed urls
 
  @PUT
  @Path("/suspend")
 
  void suspendProcessInstance();
  @PUT
  @Path("/activate")
  void activateProcessInstance();
 
 
  The calls would hit the runtime service interface, example:
 
    @Override
   public void suspendProcessInstance() {
       
    try {
      RuntimeService runtimeService = getProcessEngine().getRuntimeService();
      runtimeService.suspendProcessInstanceById(processInstanceId);
    } catch (ProcessEngineException e){
        throw new InvalidRequestException(Status.NOT_FOUND, e, "Process instance with id " + processInstanceId + " does not exist");
    }
  }

  @Override
  public void activateProcessInstance() {
    try {
      RuntimeService runtimeService = getProcessEngine().getRuntimeService();
      runtimeService.activateProcessInstanceById(processInstanceId);
    } catch (ProcessEngineException e){
      throw new InvalidRequestException(Status.NOT_FOUND, e, "Process instance with id " + processInstanceId + " does not exist");
    }
  }
 
 
  Regards, Clint

thorben.lindhauer

unread,
Aug 8, 2013, 6:01:53 AM8/8/13
to camunda...@googlegroups.com
Hi Clint,

I think this would be a useful addition to the REST API. I have got an alternative idea for the method design, keeping it closer to the resource representation, because suspending and activating is like updating a single property on the execution:

@PUT
@Path("/suspended")
void updateSuspensionState(SuspensionStateDto dto);

with the Dto corresponding to something like {"suspended": true} and depending on the value you could either suspend or activate the process instance.
Then we could in the future also build a @GET @Path("/suspended") method, if needed.

What do you think?

Best regards
Thorben

Clint Manning

unread,
Aug 8, 2013, 10:46:54 AM8/8/13
to camunda...@googlegroups.com
Hi

   Deal!  Will make the modifications  :D
Reply all
Reply to author
Forward
0 new messages