Search code examples
apigenexus

Does GeneXus have the functionality to call external program's APIs?


I understand GeneXus has the 'External Object' feature, which I can only assume is used for setting up API calls, however, I can't seem to find any documentation online for doing this. I have an external software and I wish to run a GET API call (ie api.domain.com/example) and input the received data into a transaction in my GeneXus software. Any way of doing this?


Solution

  • For calling HTTP APIs you should use the HttpClient Data Type.

    &httpclient.Host = "labs.genexus.com"
    &httpclient.BaseUrl = "/mobilecrm/rest/"
    &httpclient.Execute('GET','WorkWithDevicesCompany_Company_List_Grid?fmt=json')
    &companies.FromJson(&httpclient.ToString() )
    

    Look at this sample

    External Objects are used to integrate native objects, such as External Programs packaged as DLLS (.NET) or JARs (JAVA). This seems not to be your case.