cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
363
Views
0
Helpful
1
Replies
Highlighted
Beginner

Finesse gadget createWSRequest API

Hi,

I am trying to use createWSRequest using the arguments below:

            finesse.modules.DellFed_ScreenPopGadget.createWSRequest(restEndpoint + "5GT3C6U", {                   

  method: 'GET',     

  dataType: 'text',

  cache: false,

  data: {},

  withCredentials : true,

  async: false,

                    timeout: 20000,

  crossDomain: true,

  contentType: 'application/xml; charset=utf-8',

  processData: true,

  success: GetCustomerDataWSSuccess,

  error: GetCustomerDataWSError

  });

The restEndpoint is defined as HTTP and it is returning XML. When I execute the request it calls this.myrestRequest, In myrestRequest is further call this.mymakeRequest(encodeURI(url), this._mycreateAjaxHandler(options), params) and then gadgets.io.makeRequest(url, handler, params); I am using Cisco API that comes that I extract from some gadget.

It error out with the exception below:

errors[401 <!-- custom Cisco error page --><html> <head> <title> Cisco System - Error report </title> <style type="text/css"> a { color: #316984; text-decoration: none; } a:hover { color: #316984; text-decoration: underline; } a:visted { color: #316984; text-decoration: none; } body { background-attachment: fixed; background-color: #ffffff; background-repeat: no-repeat; color: #316984; font-family: arial,helvetica,sans-serif; } #content { border: 1px solid #d6d7d6; font-size: 93.5%; margin: 0px 10% 30px 10%; } #content-header { background-color: #eeeeee; border-bottom: 1px solid #666666; color: #666666; font-size: 124.5%; padding: 5px 15px 5px 15px; } #copyright { font-size: 75%; margin: 0px 10% 0px 10%; padding: 3px 0px 0px 0px; text-align: right; } img { display: block; margin: 0px 0px 20px 0px; } #logo { margin: 30px 10% 0px 10%; } p { padding: 5px 15px 5px 15px; } pre { padding: 5px 15px 5px 30px; } </style> </head> <body> <div id="logo"> <img src="/ciscologo.gif" alt="Cisco Systems, Inc." /> </div> <div id="content"> <div id="content-header">HTTP Status 401 - </div> <p> <b> type: </b> Status report </p> <p> <b>message: </b> </p> <p> <b>description: </b> This request requires HTTP authentication. </p> </div> </body></html>]

Question:

Can I use gadgets.io.makeRequest(url, handler, params) with HTTPS?

The endPoint points to some external source (other domain) that returns XML data to me.

Thanks.

Danny

1 REPLY 1
Highlighted
Cisco Employee

Hi Danny,

gadgets.io.makeRequest supports HTTPS, so yes you can.

The error that you pasted shows that you are getting a HTTP status code of 401. That means that you are not authenticated to use this API. So, most likely you need to fix the authorization header when you are making the request.

Thanx,

Denise