Define functions in a module

A GWS REST service is defined in a module.

You write a Genero BDL function for each service function you wish to make public. You identify functions as RESTful functions by using RESTful attributes in the function attributes clause of the function and its parameter and return values.
  • HTTP operation attributes (Verbs) define the function operation (such as the HTTP GET, or POST operation).
  • Resource path WSPath parameters (with WSParam, WSPath attributes) define the location of a resource. The path parameter value is directly related to a resource and is part of the resources URL path.
  • Attributes set on Input parameters and return values define data sent in the request and response. For example, a parameter's RESTful attribute can specify if data is carried in the body or header, as a cookie, as a query, or as multipart.

Ensure resources are unique

As function names have to be unique in your module, the Web service resource identified by functions must also be unique. In the OpenAPI specification the combination of resource path and an HTTP verb defines a unique resource.

The same resource path can support several operations, for example, GET /users to get a list of users and POST /users to add a new user, etc. However, only one operation is allowed per function and therefore you must provide separate functions for these operations.

Two GET or two POST functions for the same path are not allowed; even if they have different parameters. Input parameters or return values do not effect the uniqueness of the resource.

See the examples for defining your REST Web service functions.