AnsweredAssumed Answered

REST API : Start an instance providing the key (not the id)

Question asked by othmann on Mar 23, 2011
Latest reply on Aug 8, 2012 by gumba
Hi everyone,

  First of all, congratulations for the nice work behind Activiti.

  I need to use the REST API to start a process instance. I chose to use the process definition key instead of the process definition id, so as to start automatically the latest version of the process. It is made clear in the user guide that we can make a POST request on /process-instance with :


{
  "processDefinitionKey":"financialReport:1",
  "businessKey":"order-4711"
}

   However, the engine keeps telling me :

{
    "status" :
  {
    "code" : 400,
    "name" : "Bad Request",
    "description" : "Request sent by the client was syntactically incorrect."
  }, 
 
  "message" : "02230006 Parameter 'processDefinitionId' is missing", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 02230006 Parameter 'processDefinitionId' is missing",
 
  "callstack" :
  [
       ""      ,"org.springframework.extensions.webscripts.WebScriptException: 02230006 Parameter 'processDefinitionId' is missing"
      ,"org.activiti.rest.util.ActivitiRequest.checkObject(ActivitiRequest.java:383)"
      ,"org.activiti.rest.util.ActivitiRequest.checkString(ActivitiRequest.java:367)"
      ,"org.activiti.rest.util.ActivitiRequest.getMandatoryString(ActivitiRequest.java:291)"
      ,"org.activiti.rest.api.process.ProcessInstancePost.executeWebScript(ProcessInstancePost.java:45)"
      ,"org.activiti.rest.util.ActivitiWebScript.executeImpl(ActivitiWebScript.java:68)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)"
      ,"org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:69)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)"
      ,"org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)"
      ,"org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)"
      ,"org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)"
      ,"java.lang.Thread.run(Thread.java:662)"

  ],
 
  "server" : "Spring WebScripts - v1.0.0 (Release Candidate 2 660) schema 1,000",
  "time" : "23-Mar-2011 15:59:36"
}

  When I use the processDefinitionId attribute, it works fine. Any idea ?

Thanks,
Othman

Outcomes