This is one of my first times working with REST apis and before I go down this rabbithole I could really use some help.
I built an online experiment using JsPsych for frontend and Flask as a micro backend framework. I managed to get this experiment online deployed through Heroku.
I created a qualtrics survey, let's just call it "Decision task survey", that includes some important demographic and personality batteries/questionnaires related to my experiment.
So ideally, I'd want to embed the qualtrics survey onto the homepage of my Flask web application, `index.html`, allowing people to complete it there. Then I need some way of storing a unique identifier for that qualtrics survey, so that I can make calls to the qualtrics api to get the participant's survey data later on for data analysis. If I have read the documentation correctly, it seems like the `response id` can uniquely distinguish the completed survey responses of each participant.
* https://api.qualtrics.com/docs/listen-to-and-retrieve-responses-in-real-time
* https://api.qualtrics.com/reference#getresponse-1
But I haven't really found a source that clearly shows how I can get the `response id` in real-time for a participant that's completing an embedded qualtrics survey. I'm not sure if I truly need a web listener/webhook as shown in the "Listen to and Retrieve Responses In Real Time", and even then I'm not sure if this would actually work with heroku since it seems like there's only native support for event subscriptions to things that relate to the heroku app (https://devcenter.heroku.com/articles/app-webhooks). In addition, the call for `get response` require you to have a response id as a parameter... but that's what I need, i don't know how I'm supposed to generate that parameter.
I tried looking up some questions existing on this forum about getting the `response id` and showing that to users with javascript. These questions don't use web listeners, and instead make use of embedded data in javascript.
* https://www.qualtrics.com/community/discussion/3721/getting-responseid-using-javascript-with-getembeddeddata
* https://www.qualtrics.com/community/discussion/764/displaying-responseid-to-survey-respondents
* https://www.qualtrics.com/community/discussion/2895/how-can-i-show-responseid-at-the-end-of-the-survey
It sounds like trying to get the `request id` using embedded data might be the easiest route to take in terms of making the response id be clearly visible.
```
Qualtrics.SurveyEngine.addOnload(function()
{
var s = "${e://Field/ResponseID}";
});
```
i wasn't sure where this javascript was being posted though. I naively tried putting it in my `index.html` file after embedding the link to my survey, which failed. That redirected my attention to this link: https://www.qualtrics.com/support/survey-platform/survey-module/question-options/add-javascript/
It seems like the only way to make use of the qualtrics javascript api is by attaching the javascript code to an individual question. So I see that one possible route is to do a `console.log(s)` on one of the questions and have the user manually copy that into a `<form>` on index.html. But to avoid errors, I really would like if there was a way for me to get the request id automatically loaded into a form on `index.html`, or to a mounted endpoint of my flask application
I wanted to ask if there's any way for me to get the response id to be automatically loaded into a form or to a mounted endpoint of my flask application. If not, then getting the user to manually input the requestid seems like the only path I can take.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.