Hi, I am trying to start a process using the rest api. Here is my code
DefaultHttpClient dhc = new DefaultHttpClient(); dhc.getCredentialsProvider().setCredentials(new AuthScope("localhost", 8080), new UsernamePasswordCredentials("kermit", "kermit")); HttpPost hp = new HttpPost("http://localhost:8080/activiti-rest/service/runtime/process-instance"); StringEntity se = new StringEntity("{\"processDefinitionId\":\"myProcess:1:1234\"}", "UTF-8"); se.setContentType("application/json"); hp.setEntity(se); HttpResponse processResponse = dhc.execute(hp); System.out.println(IOUtils.toString(processResponse.getEntity().getContent())); dhc.getConnectionManager().shutdown();
i get an error {"errorMessage":"Method Not Allowed", "statusCode":405}
But when I use the same url and test it in postman with basic Authentication it says
{ "errorMessage":"no deployed process definition found with id 'myProcess:1:1358'.", "statusCode": 400 }
Please help. This is an urgent issue. The rest api is not working either way.
You need to add an content type application/json header to your request to prevent a 405 error. Are you sure there's a process definition with that id available in the Activiti Engine?
I wanted to attach a screen shot of my postman call but I couldn't. I tried processDefinitionId, processInstanceId and processInstanceKey with value as myProcess, myProcess:1:1234 and model in my json object but nothing worked. All of these postman calls returned method not allowed, 405 error