REST API with Javascript


Hi All,

I am a noob to javascript so sorry about my dumb questions. I have a cloud product which supports REST api, i am trying to build a webpage to show some content from my cloud. this is what i am doing now.

wrote a simple index.html and calling javascript, and below is my javascript, but not sure how to pass authentication and also trust the self signed certificate. Finally send the output onto webpage.

var xhr = new XMLHttpRequest();"GET", "", false);
xhr.setRequestHeader('Content-Type', 'application-xml');
xhr.setRequestHeader("Authorization", "Basic " "YWRtaW46Vk13YXJlMSE=");
// Add your code below!
var status = console.log(xhr.status);
var statustext = console.log(xhr.statusText);
alert(status text);


Welcome to NSX Automation



index.html is like below:

Welcome to NSX Automation



the same error hereā€¦

It seems that console.log(xhr.statusText); is not running correctly.

The same error in exercise 5. Making Requests.


Please see existing topics, for example this one:


it covers why its not working (course is no longer maintained), and how to pass the exercise (even though i would recommend updating to a supported course)