REST API is not returning result when using services

I am a new user of REST API, trying to develop an app in Flutter.

I have used CUBA REST API addon in the backend.
When I am calling data from entities, it works just fine but when I am using service then get no result. Trying from Postman and my flutter app but getting the same outcome.

Here is what I tested in POSTMAN.

  1. Running from Postman

this gives expected outcome,

        "_entityName": "erp_OutstationDuty",
        "_instanceName": " [detached]",
        "id": "436b09df-83aa-136b-d4b2-3536d404f03c",
        "purpose": "Visit",
        "appNo": "21000050",
        "appDate": "2021-10-05",
        "dateFrom": "2021-09-01",
        "version": 1,
        "durationType": "FULL_DAY",
        "tranType": "DEFAULT",
        "dateTo": "2021-09-01",
        "location": "DFL"

However, when I am using services, I am not getting the expected outcome.
Here is what I did for service.


@Transactional(readOnly = true)
public List<OutstationDuty> getOutstationDutyList(){
    EntityManager em = persistence.getEntityManager();
    return em.createQuery("select e from erp_OutstationDuty e "
                    , OutstationDuty.class)

Rest Services

<?xml version="1.0" encoding="UTF-8"?>
  ~ Copyright (c) 

<services xmlns="">
    <service name="erp_LeaveSystemService">
        <method name="leaveDateAlreadyApplied">
            <param name="entity" type=""/>

        <method name="getOutstationDutyList">


In Postman,

It’s not throwing any exception but no result.

Any suggestions?

Does the user have a role with the REST scope that allows reading the erp_OutstationDuty entity and its attributes? Permissions for REST and UI are managed by a different set of roles. See security scopes explanation in the documentation.

Hi Max
Yes, the same user with the same REST role retrieves all the entities but not in case of using services.

Can you reproduce it in a new sample project?

Hi Max
Sorry for being late coming back with a sample project.

I have attached two project files 1) CUBA application being used as backend REST API service and 2) Flutter app that is displaying and creating records.

CUBA based web application:
Here you can create Company, operating location, employee followed by OutstationDuty entry.

I created REST role but you might need to create on to authorize as the zip project doesn’t have the data.

When you run the app, click on the Apps in the bottom navigator then click Outstation appl as below:

You will find the list of outstation duty that you created from the web application below:

Creating new Outstation duty application:
Click on the floating button to go to the new application screen. Create new entry

and it works as you see below where 3rd list is added.

The only difference between this sample app and my real one is, one with multitenant add-on where I can not create a new Outstation duty entry and this sample is without that add-on.

Here is the error i get when i try to create a new entry in my flutter aps that is having multitenancy add-on: (Status code) 500

flutter: 500
flutter: {"error":"Server error","details":""}

CUBA based web appl sample with REST (177.8 KB)

Since whole flutter project folder is huge, I am sending you the lib and pubspec files so that you can easily copy them into a new project: (26.8 KB) (2.0 KB)

Looking forward to your help.


Sorry, but I don’t have experience in working with Flutter and unfortunately I don’t have time to learn it right now. If your problem was about executing a service using REST API then please create a very simple CUBA project with a single entity and with a single service that doesn’t work in case of REST API. What I need is this minimal CUBA project and URL that you use to invoke the service. In this case I can see the problem.

You may create a design-time role then it will always be in the project. If you use the HSQL database then the zipProject gradle task will put the database to the archive as well - in this case I will have the same data as you.

Hi Maxim
Thanks for your reply. so far I have tested it, it doesn’t look like it is related to flutter as you see it works well.

Initially, I thought it has something to do with the service but as mentioned in my previous message, post is not working when there is a multitenancy add-on used. As you see i have shared some images that demonstrate post is working in my environment but when I add the multitenant add-on it doesn’t work. Do you want to try testing if REST API Post works when there is a multitenant add-on used?