I have Springboot app that talks to Alfresco Enterprise Activiti using REST calls.
I want to start the process instance using REST call but I am getting 400 bed request. however the same request works with postman.
String url = "http://localhost:9091/activiti-app/api/enterprise/process-instances";
RestTemplate restTemplate = new RestTemplate();
restTemplate.getInterceptors().add(new BasicAuthorizationInterceptor("admin@app.activiti.com", "admin"));
HttpHeaders headers = new HttpHeaders();
headers.setContentType(org.springframework.http.MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<String>("parameters", headers);
CreateProcessInstanceRepresentation cpir = new CreateProcessInstanceRepresentation ();
cpir.setName("ClientReview");
cpir.setProcessDefinitionId("ClientReview:7:15103");
ObjectMapper mapper = mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
json = mapper.writeValueAsString(cpir);
JsonNode jsonNode = mapper.readTree(json);
restTemplate.exchange(url, HttpMethod.POST, entity, Object.class, jsonNode); // Throws 400 Bad Request
Please help..
Thank you in advance...