GeneXus has the ability to automatically create REST Web Services from transactions that are Business Component (BC), Data Provider object and procedures.
The Object-level properties involved in configuring a Rest web service in GeneXus are as follows:
- Expose as Web Service = TRUE
- Web Service Protocol = REST Protocol
By setting the necessary configuration, the data that encapsulates the BC, Data Provider or Procedure may be accessed through the web as a REST service using the HTTP protocol.
A Rest application requires a different approach than a remote procedure-based application.
In Rest, the focus is placed on the wide range of resources; for instance, a Rest application could define resources such as products, clients, purchase orders, etc.
So, the process to design an application like this would be to identify each one of its resources: remember that each resource has its own URI.
- A URI for the products and a URI for each product
- A URI for the Purchase Orders and a URI for each one.
Consider the methods that you need to implement. For example, to let end users access the list of products - GET, to access each product (GET), to insert a purchase order (POST) or to update an order (PUT). Check here for more considerations to take into account when designing your API.
Besides, take into account the parameter types, it is recommended to use basic data types (scalar types such as numeric, string, date, GUID) when using the GET and DELETE verbs, because they will use the URL queryString to transfer it; the Output does not have this restriction.
In GeneXus, developing and/or consuming a Rest service is an easy task.
As you'll see in the following documents, a Rest service is generated by setting just an object property, and the specification document of this service is generated automatically.
With respect to consuming a Rest service (it can be generated by GeneXus or not), GeneXus provides the OpenAPI import tool.