AnsweredAssumed Answered

Activiti REST call for list of tasks

Question asked by signjoy on Jun 16, 2017
Latest reply on Oct 25, 2018 by paiyyavj13

Hello all,


In one requirement we need to fetch data from Alfresco Activiti. We are using RESTTemplate call that returns us list of tasks for the particular user. The only problem is, the response is in JSON format and not showing the type of the corresponding JAVA class. Can anyone tell me that on which java class I need to cast the response?


REST call:  http://localhost:8080/activiti-app/api/enterprise/tasks/query



      "size": 1,
      "total": 1,
      "start": 0,
      "data": [
       "id": "42589",
       "name": "Director Review",
       "description": null,
       "category": null,
       "assignee": {
                            "id": 1,
                            "firstName": null,
                            "lastName": "Administrator",
                            "email": ""
       "created": "2017-06-15T20:02:26.684+0000",
      "dueDate": null,
      "endDate": null,




In my JAVA code how and which JAVA object needs to be created like below...


ResponseEntity<ResultListDataRepresentation> result =  restTemplate.postForEntity(url, entity, ResultListDataRepresentation .class);
ResultListDataRepresentation rldr = result.getBody();
List<TaskRepresentation> list = (List<TaskRepresentation>) rldr.getData();   // No issue 
System.out.println("The size is: " +list.get(0)); // Prints size 1  
TaskRepresentation t = list.get(0); // Throws below exception :-(
java.lang.ClassCastException: com.activiti.model.common.AbstractRepresentation
cannot be cast to com.activiti.model.runtime.TaskRepresentation


But I need something like to easily manipulate the object.


    List<Task> taskList = restTemplate.postForObject(url, entity, Task.class);






Thanking you