Below is a use case of a RESTful service (in fact, it's a Business Component exposed as a Rest service).
Suppose that you want to build a consumer for that service.
To do so, you activate the Generate OpenAPI interface property so that the default.yaml file is available.
As you need to implement a consumer, the documentation will help you for that purpose.
The information of the OpenAPI (Swagger) docs can be easily read using the OpenAPI import tool. However, here it is explained how the same process could be done (with a rational analysis effort) using the Swagger UI tool.
Consider the Product Transaction object structure defined as follows:
Its properties are set as follows:
- Business Component property = True
- Expose as Web Service property = True
- Web Service Protocol property= Rest Protocol
Let's focus on the HTTP POST method. For this HTTP method in particular, the default.yaml file includes the following lines:
summary: "Inserts a Product"
- name: "ProductId"
description: "Product Id"
- name: "Product"
description: "SDT of Product"
description: "Successful operation"
description: "Not found"
Graphically, it is represented by the Swagger UI as shown below:
You can click on "Try this operation" and complete the request form that appears, which looks as shown in this example:
After completing the form, you will have the following summary of the HTTP Request where you can get information about the HTTP headers used to execute the HTTP POST verb, and the JSON body format.
The JSON Body can be imported in GeneXus using the JSON Import tool (Tools > Application integration), and the correct SDT for that JSON format will be automatically created in the KB.