Hi all, I’m new to camunda and I want to integrate camunda REST API in my own spring boot application. Below the details of my application properties file:
Do you use the camunda spring boot starter? If so, you should be able to activate rest by just adding the camunda-bpm-starter-rest dependency to your project.
@jangalinski thanks for your reply. Deleted other dependencies. And run as springboot application now I don’t know how to access the camunda REST API via postman. I tried http://localhost:8081/api/engine is that correct?
Using camunda-bpm-spring-boot-starter-rest it will set up a default Rest API service
which you can’t change, so you don’t need to define it but just provide your CamundaJerseyResourceConfig and CamundaBpmRestJerseyAutoConfiguration as new Rest API service implementation extending the default class
Following an example: CamundaBpmRestJerseyAutoConfiguration
@AutoConfigureBefore({JerseyAutoConfiguration.class})
@AutoConfigureAfter({CamundaBpmAutoConfiguration.class})
public class CamundaBpmRestJerseyAutoConfiguration
{
@Bean
@ConditionalOnMissingBean({CamundaJerseyResourceConfig.class})
public CamundaJerseyResourceConfig createRestConfig()
{
return new CamundaJerseyResourceConfig();
}
}
As you can see I registered a CustomProcessEngineRestServiceImpl class as my new Rest API service implementation just overriding DefaultProcessEngineRestServiceImpl and registering your custom Rest service implementation (e.g TaskRestService)
For example I extended the TaskRestService with this steps:
Extend TaskResourceImpl as CustomTaskRestServiceImpl to override a specific method (eg. claim, complete) or adding a new endpoint method
Register your custom TaskRestService implementation subclassing DefaultProcessEngineRestServiceImpl as custom Rest API service
public class CustomProcessEngineRestServiceImpl extends DefaultProcessEngineRestServiceImpl {
@Path(TaskRestService.PATH)
public TaskRestService getTaskRestService() {
CustomTaskRestServiceImpl subResource = new CustomTaskRestServiceImpl (null, getObjectMapper());
return subResource;
}
But getting this error – class path resource [org/camunda/bpm/engine/spring/SpringProcessEngineServicesConfiguration.class] cannot be opened because it does not exist
You have to carefully check which camunda, which spring boot and which camunda-bpm-starter version you are using.
Due to rapidly changing spring boot infrastructure, some strict constraints apply.