Avatar

Community Advisor

HI,

yes, this is general process. Below you may find important parts of the mentioned function:

function getJSONResponseFromAPI(method,,credentials,some_parameters){

  var jsonResponseFromAPI = null;

 

  try{ 

    var endPoint = 'http://dump_address.com'

    var apiCallMethod = "GET";

    var http = new HttpClientRequest(endPoint);

    var buffer = new MemoryBuffer();

   

    ....

   

    http.execute();

   

    var rsp = http.response;

    var responseContent =  rsp.body.toString(rsp.codePage);   

    buffer.dispose();

     ...

    jsonResponseFromAPI = JSON.parse(responseContent);

     ...

  return jsonResponseFromAPI;

}