cancel
Showing results for 
Search instead for 
Did you mean: 

Start process using Activiti REST with variable

alexm123
Champ in-the-making
Champ in-the-making
Hi, I am trying to start process using Activiti REST.

If the process has not form input, I can start it successfully and see it in Activiti Explorer.

But when I try to start a process with a start form attach to it, I fail, getting Respond Code 400.

(without the "js.put("name","kermit");" I can start it successfully.

I read the user guide, but didnt figure it out.

Below is my code,  any suggestion would be helpful


      String url = "http://kermit:kermit@localhost:8080/activiti-rest/service/runtime/process-instances";

      HttpClient client = new DefaultHttpClient();
      HttpPost post = new HttpPost(url);

      post.setHeader("Accept", "application/json");
      post.setHeader("Content-type", "application/json");
        post.addHeader("Authorization","Basic a2VybWl0Omtlcm1pdA==");
      // add header
      post.setHeader("User-Agent", USER_AGENT);
      JSONObject js= new JSONObject();
      js.put("processDefinitionId", "processVar:1:12548");
      js.put("name","kermit");
      StringEntity params=new StringEntity(js.toString());   
      post.setEntity(params);
      HttpResponse response = client.execute(post);

1 REPLY 1

jbarrez
Star Contributor
Star Contributor
variables should be in an array, with name, value pairs. Check the docs for the correct format.