Create a Spring Controller in a Bloomreach project

Hello,
I am trying to create a Spring rest controller in my Bloomreach project but the API is not recognised

Here is my Rest controller class . Is there a way to integrate Spring framework annotations inside Bloomreach project ? Am I missing a config change ? Do I have to match the url somewhere, or create a xml configuration ? Thank you

@RestController
public class CVentAPI {
private static final Logger LOGGER = LoggerFactory.getLogger(CVentAPI.class);

@RequestMapping("/test")
public void testMethod(){
    LOGGER.info("asdasdasdasdasd");
}

}

@jasper.floor - I know you are the best here and always helped me

Any help is much appreciated :slight_smile:

I will wait for @jasper.floor to reply :wink:

Hi @machak - I owe you if you can help me here :smiley: I know you guys are the best on Bloomreach stuff . I remember you helped me perviously on Bloomreach support platform

A good start would be:

for component parts check:

1 Like

Hello @omoldovan

Bloomeach is exposing a way of creating APIs through JAX-RS services.

take a look at Expose RESTful Web Services: Overview - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS especially Plain JAX-RS Service which is kind of what I guess you want to accomplish.

1 Like

@jacek.klimonda, @machak Thank you both for your help,

I was able to integrate spring framework into hot container, and created a couple of APIs. But, the issue is that when I’m trying to create a POST request which accepts as parameter a @RequestBody object, I am getting a 415 error " Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type ‘application/json;charset=UTF-8’ not supported] " even though I set the consumes attribute in my post mapping

Below is a snapshot of my API call and my object

Do you know if this something Bloomreach related ? I have worked on my other Spring projects like this and never got this issue

Also snapshot of Postman call

Found the issue - had to add a specific tag inside my configuration file
<mvc:annotation-driven />