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

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

  • February 10, 2020
  • 2 replies
  • 95 views

Forum|alt.badge.img+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

  • February 11, 2020
Hi, I think you need to write X-API-TOKEN ( in capital letters ) Line

Forum|alt.badge.img+2
  • Author
  • February 12, 2020
I also tried with X-API-TOKEN but it didn't work.