"Expected authorization in headers, but none provided" while getting a survey response via JS in SI | XM Community
Skip to main content
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); })();
Hi, I think you need to write X-API-TOKEN ( in capital letters ) Line
I also tried with X-API-TOKEN but it didn't work.