HowTo: Consuming a Rest Data Provider

Official Content
This documentation is valid for:

This document explains how to call a Data Provider (DP) exposed as Rest web services in GeneXus.

First, let's see the basic guidelines:

How do I call the Rest service in GeneXus?

Use the HttpClient data type.

Which HTTP method should I use to call the Rest Data Provider?

The HTTP method used for calling the Data Provider is the HTTP GET verb.

Which is the URL format to execute the GET verb?

<ServerUrl>/<module>/<DP name>?<param1>=<value1>&<param2>=<value2>,..,<paramN>=<valueN>

Where <param1>,<param2>,..,<paramN> are the parameters of the DP. The parameters should be separated by &.


Consider the Invoice Business Component transaction, which looks as follows:


We have created a DP (called "DPCaso20"), whose Data Provider Output is the Invoice BC. Also, it's exposed as a Rest service. See the figure below:


The DP has the following rule:

parm(in:&invoicedate,in:&CustomerId, in:&Customername);

To call that Rest DP, we have the following code:

&httpclient.Host= "server"
&httpclient.Port = 8080
&httpclient.BaseUrl = "BaseUrl"
& = 0

if &httpclient.StatusCode = 200
    &result = &httpclient.ToString()
   msg("Error: " + &httpclient.StatusCode.ToString())

Download the sample from Sample consuming a Rest DP


  • If the service URI is "http://localhost/TestRESTFullGX.NetEnvironment/rest/Invoice", the BASE URL is: "/TestRESTFullGX.NetEnvironment/rest/"
  • In Java, the parameters name must be normalized (First Character must be uppercase, and all the others must be lowercase) , in this example: Invoicedate, Customerid and Customername. 
  • Error handling is managed by querying the HTTP Status Code after the invocation.

See Also

Rest web services in GeneXus


Concerning consuming a Rest service (it can be generated by GeneXus or not), GeneXus provides the OpenAPI import tool.