Define http verbs (GET, POST,...) for rest-service.xml, mapping from views


  1. I use rest-service.xml for my API. Is there a way to define that a method only allows GET or POST requests?
  2. I tried to create a response by returning an entity (consumer) as shown in pet-clinic (PetServiceBean#findById).
    When I return the entity I only get
    “_entityName”: “consumer”,
    “_instanceName”: “com.some.package.entity.Consumer-285b402c-0b72-8be9-6439-08aff33ca9ce [detached]”,
    “id”: “285b402c-0b72-8be9-6439-08aff33ca9ce”

If I return a class which wraps the consumer entity than i get all values defined in the view loaded with dataManger…

What could be my failure that this doesn’t work as in pet-clinic shown?

Thank you!!!


  1. REST services provide some functionality out of the box. If this functionality is not enough, you can create your own Spring MVC controller. Spring MVC is fully configurable, including limiting HTTP verbs for a method.

  2. Maybe you are loading the entity with _minimal view in this service?

@AlexBudarov thank you very much.
ad 2. I forgott to config my entities in the AnnotatedRoleDefinition with EntityAccess and EntityAttributeAccess.

@AlexBudarov If this feature also looks interesting to you I created a pull request: added httpMethod to RestServicesConfiguration by klaus7 · Pull Request #136 · cuba-platform/restapi · GitHub