Watts-Lab / deliberation-empirica

Empirica V2 framework
MIT License
6 stars 0 forks source link

Fetch data from qualtrics via API #452

Closed JamesPHoughton closed 1 year ago

JamesPHoughton commented 1 year ago

In https://github.com/Watts-Lab/deliberation-empirica/issues/426, we made qualtrics work in an iframe, but the data doesn't make its way back to empirica anywhere. We should have a callback on the server that uses the qualtrics API to fetch this data and attach it to the player object.

JamesPHoughton commented 1 year ago

Thinking about using a third party API wrapper:

  1. Connect to API using third party wrapper: https://www.npmjs.com/package/qualtrics-api

  2. Set Environment Variables

Challenge of knowing

Using raw API:

As we really only want to make one API call: https://api.qualtrics.com/1179a68b7183c-retrieve-a-survey-response The API endpoint takes a responseId parameter:

https://yul1.qualtrics.com/API/v3/surveys/{surveyId}/responses/{responseId}

But what we get from the end of survey message on the browser is the sessionId.

image

https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/embedded-data/

There may be an informal relationship between sessionId and responseId. Test survey 1

Different survey

Looks like we can just replace the FS_ with R_.