AnsweredAssumed Answered

Start process instance by user (using rest api)

Question asked by gertp on Aug 27, 2014
Latest reply on Jul 15, 2015 by youtianhong
Hello, in an older thread (titled "start process instance by user") somebody could not see the user set in the "start_user_id_" column in the "ACT_HI_PROCINST" table, and thus could not see the process instance in activiti-explorer. The solution to this was a follows:

<startEvent id="request" activiti:initiator="initiator" />
The authenticated user must be set with the method BEFORE the process instance is started,
try {
  identityService.setAuthenticatedUserId("bono");
  runtimeService.startProcessInstanceByKey("someProcessKey");
} finally {
  identityService.setAuthenticatedUserId(null);
}


I want to start a new process using the rest api, the command to start this is:

C:\Users\upf>curl -uX:X -X POST http://XXX:8989/activiti-rest/service/runtime/process-instances –header "Content-Type:application/json" -d @x


where the file x contains the following:

{
   "processDefinitionKey":"XWorkflow",
    "variables": [
      {
        "name":"priceDate",
        "value":""
      }
   ]
}


The process starts up fine, but it does not set the authenticated user, the "start_user_id_" is null and I cannot see the instance in actitvit-explorer. Does anyone know how how one can set the authenticated user with rest so it is equivalent to the java code that launches the process. I thought it might be curl that is not passing in the user, so I tried the rest plugin for chrome called "Postman" it also did not manage to set the user.

Thanks in advance.

Outcomes