0
votes

I am using activiti community version 6.0. I have gone through the documentation but cannot see a REST API to retrieve task-form.

I noticed Activiti uses following request url to get the form definitions:

http://localhost:8080/activiti-app/app/rest/task-forms/{taskId}

I tried using this url along with a restTemplate to access the task forms and resulted in 401 error code.

@Service
public class GetTaskForm {

String baseURL = "http://localhost:8080/activiti-app/app/rest/task-forms/";

public void getTaskForm(String taskId){
    String taskURL =  baseURL + taskId;
    RestTemplate restTemplate = new RestTemplate();
    String taskForm = restTemplate.getForObject(taskURL, String.class);
    System.out.println(taskForm);
 }
} 

What would be the best way to achieve this?

2
What happens if you send some authentication details along with the request? - Gagravarr
Send Authorisation header - Derrops
I tried calling the same url using postman with basic authorisation and didn't work. - BlueStar

2 Answers

0
votes

Refer this documentation to get task form and if you are sending your request from outside of activiti then as Snickers3192 said you have to pass activiti authorization header in the request.

0
votes

You are looking for the form definition (JSON) for forms that re built using the Form Modeler in version 6. The ReST API documented does not support returning this as it is part of the orm engine configuration, If you look at the source in activiti-ui/activiti-app-rest you will find the ReST endpoints for the form engine.

The best place to find documentation for these API is in the Alfresco Enterprise Edition docs as Enterprise edition extends on the activiti-app implementation:

http://docs.alfresco.com/process-services1.7/topics/task_form.html

Obviously there are gaps between community edition and enterprise edition, but this should give you what you need. And, the URL you list should return the form definition as long as you are properly authenticated.