"Expected authorization in headers, but none provided" while getting a survey response via JS in SI | XM Community
Question

"Expected authorization in headers, but none provided" while getting a survey response via JS in SI

  • 10 February 2020
  • 2 replies
  • 56 views

Badge +2
Hello, I am trying to fetch a Survey Response via JS in SI but I am getting this error "Expected authorization in headers, but none provided". When I run the same code via JS in a surveyflow I am able to fetch the response without any issues. Any suggestions what could be wrong? I am running following code

(function() {

var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});

xhr.open("GET", "https://brandid.dc.qualtrics.com/API/v3/surveys/SV_12334521/responses/R_2323223232");
xhr.setRequestHeader("x-api-token", "xxxxxxx");
//xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");
xhr.send(data);
console.log(data);
})();

2 replies

Userlevel 1
Hi,

I think you need to write X-API-TOKEN ( in capital letters )

Line
Badge +2
I also tried with X-API-TOKEN but it didn't work.

Leave a Reply