I have installed Alfresco Process Services on my local machine. I have also created a springboot project to write custom listeners like Task listener or execution listeners. These listeners are working fine. I create a jar file and put it into webapp\activiti-app\WEB-INF\lib folder.
Now I want to add REST endpoints in my application so that external users can directly take an action on task.
I added the following class beside my main application class which has the main method.
@RestController
@RequestMapping("/api2")
public class WorkflowController {
@RequestMapping("/greeting")
public String greeting(@RequestParam(value="name", defaultValue="World") String name) {
return "Hello from " +name;
}
}
The issue is when I try to access the endpoint via any of the below URL it gives me 404 error.
http://localhost:8081/activiti-app/api2/greeting
OR
http://localhost:8081/api2/greeting
Please help
To access the URL publicly you need to start your mapping with /enterprise
. APS requires this to distinguish between public and private rest APIs, so your @RequestMapping("/api2")
should be @RequestMapping("/enterprise/api2")
which should then be accessible with http://localhost:8081/activiti-app/api/enterprise/api2/greeting
. refer the developer series for a detailed example.