Official Content

In a real-life situation, you will probably need to provide feedback about the operation to the user, so you can use a Business Component to perform actions in the database tables and return the operation results to the caller consumer.

In the example, "AddCustomer" Procedure is declared as REST web service in GeneXus.

  • Expose as web service = true
  • Rest protocol = true


It receives an SDT as a parameter, containing the information of the customer to be added to the Customer table.
Also, it returns the error and warning messages in the variable &messages, in order to be able to provide feedback about the operation to the user.

Note: Rest procedures can receive any type of parameters: simple or SDTs, collections or not.

Parm Rule:




if &Customer.Fail()
 &Customer = new()
 &Customer.CustomerId = &Customersdt.CustomerId

&Customer.CustomerName = &Customersdt.CustomerName
&Customer.CustomerBirthDate = &Customersdt.CustomerBirthDate
&Customer.CustomerPayDate = &Customersdt.CustomerPayDate
&customer.CustomerPhoto = &customersdt.CustomerPhoto

&messages = &customer.GetMessages()

Variable &Customersdt is based on Customersdt Structured Data Type:


A GeneXus client for this REST procedure would be as follows:

&httpclient.Host = &host
&httpclient.Port = &port
&httpclient.BaseUrl = &baseurl

&body = '{"Customersdt":' + &customersdt.ToJson() + '}'


Then process the HTTP Client response.


  • The BaseURL for calling REST Procedures is <webappname>/rest.
  • Note that the HTTP request is in Json format. Since the Procedure receives an SDT (Structured Data Type), the Json expected is preceded by the name of the SDT, which has to be in the same casing as the parameter of the Procedure (&Customersdt).

So, the HTTP Request is as follows:


See Also

Rest web services in GeneXus

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant