AnsweredAssumed Answered

Calling External Api

Question asked by dhinesh.r@hcl.com on Aug 12, 2016
Latest reply on Aug 15, 2016 by dekwan

Hello ,

 

I have tried to call the external public API for testing from the gadget which runs within Finesse Server.

But it is not working due to cross domain policy .

 

Is Finesse allows to call external API hosted in different servers ?

Below is the code i have modified from Sample Webservice gadget.

 

// TODO: change Rest path to match your own web server

  this.myrestRequest("/country/get/iso2code/IN", {

                method: 'GET',

                success: handlers.success,

                error: handlers.error,

                content: contentBody,

            });

            return this;

 

mymakeRequest : function (url, handler, params) {

            clientLogs.log("mymakeRequest(): in method");

               

            params = params || {};

            params[gadgets.io.RequestParameters.HEADERS] = params[gadgets.io.RequestParameters.HEADERS] || {};

           

                       

            // This is the url we want to get to:

            gadgets.io.makeRequest(encodeURI("http://services.groupkt.com") + url, handler, params);

            clientLogs.log("mymakeRequest(): io.makeRequest to http://10.221.226.26"+url);

        },

 

 

Thanks

Dhinesh

Outcomes