Help with rest API - custom url mapping

I’m trying the rest api plugin for the first time… Im having problems getting started on a simple task of creating a custom url mapping. i dont have a portal. it should be on a web screen controller?

I dont know where to put this file? Do I have to create it on the beans.
I dont want queries or anything else just create a simple mapping and return a string
I added = true
to test on the file.


import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

public class MyController {

protected SomeService someService;

public String doSmth() {
    return "HELLO"


I’d like to see the response on

thanks for the help

Creating custom oauth-protected REST API controllers is described here:

Hello. thank you for your response. Thats where I copied the example I i posted. wanted anonymous access… no OAuth. Also, I have no idea where that class has to go.

If you don’t need OAuth authentication, then you can just create a Spring MVC controller in the web module. However you would need to setup some security settings, because CUBA will not allow you to read any data with DataManager without specifying a user session in your code.

Since similar questions are being asked from time to time, I’ve created a sample project. Description is in its file.