4.7.1.1. Including in a Project

REST API is included as a dependency to the web and portal modules of the cuba base project. By default, it is turned on in the portal module and off in the web module. So if you need REST API, you have two options:

  • Create the portal module in your application project. Open the project in CUBA Studio and click the Create portal module link on the Project properties navigator panel. After that, the REST API functions will be available at the {host:port}/app-portal/api URL.

  • Turn on REST API in the web module. Open the project in CUBA Studio and go to Project properties > Edit > Advanced and select the REST API in web module checkbox. After that, the REST API functions will be available at the {host:port}/app/dispatch/api URL.

REST API controllers are registered in the Spring context defined by the dispatcher-spring.xml file of of the corresponding module (portal-dispatcher-spring.xml or web-dispatcher-spring.xml):

<context:component-scan base-package="com.haulmont.cuba.restapi"/>