REST API service configuration

Hi,

I am using the REST API V2 to login and get a list of entities as documented. However for services, I need to create an XML file as I have done here:


<?xml version="1.0" encoding="UTF-8"?>
<services xmlns="http://schemas.haulmont.com/cuba/rest-services-v2.xsd">
    <service name="slm_FixtureService">
        <method name="getFixtures">
        </method>
	</service>
</services>	

I then need to configure this file in the web.xml file:


   <!-- Application properties config files -->
    <context-param>
        <param-name>appPropertiesConfig</param-name>
        <param-value>
            classpath:cuba-web-app.properties
            classpath:com/company/slm/web-app.properties
            /WEB-INF/local.app.properties
            "file:${catalina.home}/conf/app/local.app.properties"
	cuba.rest.servicesConfig = +rest.xml	
        </param-value>
    </context-param>

I have placed the rest.xml in several places but still not getting the expected results. When I call the service defined in rest.xml through the API, I get an error “Service method not found”.

Where should I place the rest.xml file and how can I resolve this error?

Hi,

Please see the example of service invocation here: Service Method Invocation (GET) - CUBA Platform. Developer’s Manual

This chapter explains where the files must be placed:

Before the execution with the REST API a service method invocation must be allowed in the configuration file. The sales-rest-services.xml file must be created in the main package of the web module (e.g. com.company.sales). Then the file must be defined in the application properties file of the web module (web-app.properties).

So instead of the web.xml file you must place the line cuba.rest.servicesConfig = +rest.xml to the web-app.properties file.

You can read more about application properties here: Application Properties - CUBA Platform. Developer’s Manual