Rest API - Getting an Entity Instances List with parameters

Hello, I am using cuba´s rest api. When I use get method to http://localhost:8080/app/rest/v2/entities/adminpb$Awe, it works.

But when I add the “?view=browse&limit=10” to this url, I get Server Error.

In the stack trace i get:


2017-01-16 15:56:01.608 ERROR [http-nio-8080-exec-46/app/fernbi] com.haulmont.restapi.controllers.RestControllerExceptionHandler - Exception in REST controller
com.haulmont.cuba.core.global.ViewNotFoundException: View adminpb$Awe/browse not found

The browse view was created using "Create Standards screen’ in the Entity tab.

And when I type http://localhost:8080/app/open?screen=adminpb$Awe.browse, it works. Thus, the view adminpb$Awe/browse exists.

Source: https://doc.cuba-platform.com/manual-6.3/rest_api_v2_ex_get_entities_list.html

Hi Igor,

can you share the views.xml in order to get a little bit more information about your problem?

Bye
Mario

Mario,

This is what I have in my view.xml:


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<views xmlns="http://schemas.haulmont.com/cuba/view.xsd">

</views>

Thanks in advance

views

Well, this xml file doesn’t contain any views at all. I think you mixed up screens with view.

view - a representation of a set of entity attributes that should be automatically loaded through one (or a few) sql statements. You can think of a CUBA view similar to something like a SQL view) (just to get a basic idea) (views docs.

Here you can find an example of a view definition: https://github.com/mariodavid/cuba-ordermanagement/blob/master/modules/global/src/views.xml

screen - a GUI representation that normally manifests itself in a tab in the UI. An example of this the screens are browse screens and editors for a particular entity. Screens use views in order to fetch the data through datasources screens docs.

I would suggest that you check out the mentioned docs to get a further idea about the mechanics.

Bye
Mario

You are right!! My mistake!

I replaced ‘view’ for ‘screen’ in “?scren=browse&limit=10” and worked!

Thanks