This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

JVx' REST interface Update for JVx 2.8

Our generic REST interface in JVx is well documented and different examples for different technologies are available. The generic approach itself is smart but not super specific because the implementation follows the CoC paradigm. It's awesome for "REST out-of-the-box" without additional coding effort, but the flexibility is sometimes missing.

We tried to break some of this restrictions and get more flexibility. Here is a list of new features to explain some details:

  • Fetch on demand

    The old implementation always returned all records from the database. It wasn't possible to implement paging or lazy loading. To solve this problem, we introduced new request parameters:

    _firstRow
    _maxRows

    With _firstRow (starts from 0) you define the start record number. The _maxRows defines the amount of records for the resultset, e.g. start from 0 and return max. 20 records, start from 20 and return 20 records

  • Configure visible columns

    The old implementation returned the same column list for the REST call and the GUI/frontend. But sometimes the REST call should return a different list of columns because some internal columns aren't relevant or should be hidden. The new implementation got a new property in the metadata object: visibleColumnNames. If you set this property, the REST interface will return only the configure columns. The GUI won't recognize the new property because GUI controls have own visible column properties.

  • Actions with Array parameters

    The old implementation didn't support simple Arrays like BigDecimal[] as parameter types for action calls. Only List was supported. The new implementation supports Arrays but it's not possible to mix Array and List parameters. An example:

    //valid
    public String createPerson(String[] name, String[] title)
    //valid
    public String createPerson(List<String> name, List<String> title)
    //invalid
    public String createPerson(String[] name, List<String> title)
  • New admin zone

    We introduced a new admin zone for generic admin options. The URLs are:

    http://.../services/rest/APPLICATION_NAME/_admin/ACTION_NAME
    http://.../services/rest/APPLICATION_NAME/_admin/ACTION_NAME/ACTION_PARAM

    Currently, we support following actions (POST requests): changePassword, testAuthentication

    The request needs a JSON object with username, oldpassword, newpassword or password properties.

  • Configurable zones

    We now allow custom zones. The current default zones are:

    http://.../services/rest/APPLICATION_NAME/_admin/...
    http://.../services/rest/APPLICATION_NAME/LIFECYCLE_CLASS/data/OBJECT_NAME/...
    http://.../services/rest/APPLICATION_NAME/LIFECYCLE_CLASS/action/ACTION_NAME/...
    http://.../services/rest/APPLICATION_NAME/LIFECYCLE_CLASS/object/OBJECT_NAME/...

    The zone names are: _admin, data, action, object
    It's possible to set custom names with following parameters in the deployment descriptor: zone.admin, zone.data, zone.action, zone.object

  • Hide object names

    If you want to hide the object name(s), e.g.

    https://.../demoerp/services/rest/DemoERP/Customers/data/customer/

    The URL contains the Lifecycle Name (Customers) and the object name (customer). Both are easy to understand. In this example, we return the customer list from our customers object. If you want to use different names, it's possible to change the name in the lifecycle object code, e.g.

    @Replacement(name="business")
    public class Customers extends Session
    {
        @Replacement(name="clist")
        public IStorage getCustomer()
        {
            ...
        }
    }

    With above code, it'll be possible to request:

    https://.../demoerp/services/rest/DemoERP/business/data/clist/

The updated implementation is still a generic solution but it's now more flexible than before and should help you to offer new services. To use the new features, simply use our nightly JVx builds.