Consuming REST Data Providers in GenexusOfficial Content

Let's suppose that we need to consume the following REST web service in our GeneXus application:

where its response is in JSON format and looks as follows:



To consume it in GeneXus:

1. Define a Structured Data Type as follows:


2. Write the following code in your GeneXus object (use HttpClient data type):

&httpclient.Host = ""
&httpclient.BaseUrl = "/mobilecrm/rest/"
&companies.FromJson(&httpclient.ToString() )


&htttpclient is a HttpClient data type variable and

&companies is a collection variable based on the Structured Data Type defined previously.

3. Finished! you already have your companies loaded in your &companies variable

See Also

Rest web services in GeneXus