1

I'm trying to make a http get request in genexus, but in the object httpclient i can't find the property that have the answer and the method Execute() don't return the response of the request.

I need to copulate the json response in one SDT.

I try something like:

&httpClient = new()
&httpClient.BaseUrl = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' + &LocalLatitudeA + ',' + &LocalLongitudeA + '&key=xxxxxxxxxxxxx'
&httpClient.Execute('GET', &httpClient.BaseUrl)
Meliodas
  • 41
  • 7

1 Answers1

2

You can do this to retrieve data from an HTTP endpoint and load a SDT with the result:

&HttpClient.Execute(!"GET", !"https://reqres.in/api/users?page=2")
&Users.FromJson(&HttpClient.ToString())

&HttpClient.ToString() returns the response as a string, and &Users.FromJson() loads the &Users SDT with the received data.

ncardeli
  • 3,452
  • 2
  • 22
  • 27