Query the individual results of a survey via REST API

AndyMc
AndyMc AustraliaCommunity Member - Trial User Qubie ✭

I'm trying to understand how to query the individual results of a survey.

  • I configure an Event Subscription for "surveyengine.completedResponse.{SurveyID}".
  • Qualtrics sends a push notification to my server with the ResponseID and SurveyID each time {SurveyID} receives a response.
    How do I then get the data associated with that response? From reading the documentation making a request to https://yourdatacenterid.qualtrics.com/API/v3/responseexports will give me ALL responses - I just want the single response.

Best Answers

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭
    Accepted Answer

    You've identified what I believe is a major outage in the version 3 API. I really don't understand what they are thinking. It is one of the most common uses of the API, but to do it in version 3 you have to jump through a bunch of hoops. You can determine a startDate before your response to filter the responses somewhat, then search through the results to find the actual response you are looking for.

    Or, you could use v2.5 of the API and use getLegacyResponseData. It will return the single response you are looking for.

    Qualtrics managed to change what was a relatively simple to program single API call in version 2.5 into a minimum of 3 API calls with a bunch programming around them in version 3.

  • Michael_Campbell_RedPepper
    Michael_Campbell_RedPepper Pleasant Grove, UTCommunity Member, Qualtrics Partner Sage ✭✭✭
    Accepted Answer

    @TomG, I fully agree with that statement. This is definitely one of the major gaps in the API.

    We had a hosted solution that did this, but it has to happen in 4 steps, using the 'Responses Export' functionality of the API here: https://api.qualtrics.com/docs/create-response-export

    1) You kick off the creation of the export with the call to https://yourdatacenterid.qualtrics.com/API/v3/responseexports, passing in the format you want it in, the surveyId you want exported, and filterable fields like StartDate, EndDate, Limit, etc.

    2) That will return an Export Status ID (ES_xxx..), to which you can send to the 'Get Response Export Progress' Endpoint here: https://yourdatacenterid.qualtrics.com/API/v3/responseexports/:responseExportId. That will give you the percentComplete of the progress,

    3) Then, once its finished, you call the 'Get Response Export File' Endpoint here: https://yourdatacenterid.qualtrics.com/API/v3/responseexports/:responseExportId/file.

    4) It will respond with a ZIP folder of all your responses. From there, you unzip, extract, and read the first row of the responses to get your data.

    That does seem like a lot, but we had a customer who's project required that exact solution. We were able to get that process down to less than 2 or 3 seconds at times.

Answers

  • AndyMc
    AndyMc AustraliaCommunity Member - Trial User Qubie ✭

    Thanks @Michael_Campbell_RedPepper and @TomG for your responses (I've accepted both as @Michael_Campbell_RedPepper describes what the (very clunky) process is) and @TomG has provided a workaround.

    Any idea if Qualtrics are going to (re)introduce the ability to query a response by Id in a single API call? v3.5 perhaps?

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    @AndyMc,

    I have no idea. All three of us should submit a feature request for it!

  • AravindA
    AravindA SeattleCommunity Member - Trial User Qubie ✭
    edited May 2018

    Thanks for the feedback, everyone! This is on the Qualtrics response team's feature backlog. Stay tuned!

  • PioKol
    PioKol Community Member, Qualtrics Brand Admin Qubie ✭

    Hi!
    Is there any news on it?

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    @PioKol said:
    Hi!
    Is there any news on it?

    Not that I've seen. It is not listed in the API Reference.

  • Johnsimmons
    Johnsimmons Detroit, MICommunity Member, Qualtrics Brand Admin Qubie ✭

    Does this feature exist yet? I've been waiting for v3 of the API to support this for years...

  • Tenacious
    Tenacious Somerset WestCommunity Member - Trial User Qubie ✭

    Hi. Any update on this? It seems to be a pretty coveted feature based on my online research. Be great to get an update a sto when this will be available.

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    @Tenacious - It has been available for a few months: https://api.qualtrics.com/reference#getresponse-1

  • Tenacious
    Tenacious Somerset WestCommunity Member - Trial User Qubie ✭

    @TomG that request allows me to get a survey response if I have the responseId. What I need is to get the responseId so that I can use it. I don't see a way to do this via API request

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    @Tenacious - If you are triggering the call from an end of survey action or in a end of survey redirect, you pipe the response id as ${e://Field/ResponseID}.

  • Tenacious
    Tenacious Somerset WestCommunity Member - Trial User Qubie ✭

    I'm using Postman to simulate it. Any direction on how? I'm fairly new to the Qualtrics API

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    Look up some response ids for your survey under Data & Analysis.

  • Tenacious
    Tenacious Somerset WestCommunity Member - Trial User Qubie ✭

    Yeah I did that. Was just hoping to be able to fetch the responseId via API via the surveyID. That way I can develop an API process.

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    You can export all the responses for a survey id to get response ids. That's the 3 step process discussed earlier in this thread.

  • Tenacious
    Tenacious Somerset WestCommunity Member - Trial User Qubie ✭

    Maybe I should give more information as to what I am trying to accomplish.

    I need to synchronise the SAP IDP users and groups with the users and groups in Qualtrics. Our IoT platform of over 300,000 Things uses the SAP IDP for authentication of around 3,000 users each belonging to various groups that are asserted to roles on the Portal and IoT platform for authorization.

    We need to make surveys available to groups of these users but we obviously don't want to manage this separately.

    So we thought that the best way to do this is when a user is assigned a user group in the IDP, our app can immediately update the same change in the Qualtrics structure.

    That's the first requirement which we are able to manage via API.

    The next requirement is to manage the surveys and responses to update our master data with response data and scores. This is where we currently are facing a challenge.

    I hope that with this background you are able to have enough insight into our challenge to assist.

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    Yes, as I said above:

    @Tenacious - If you are triggering the call from an end of survey action or in a end of survey redirect, you pipe the response id as ${e://Field/ResponseID}.

    You want to use an action to run a web service when there is a survey response. Pass the SurveyID and ResponseID to your web service.

  • Tenacious
    Tenacious Somerset WestCommunity Member - Trial User Qubie ✭

    Thanks @TomG . Let me try that.