Aligning API responses for Survey Definition and Export Response endpoints | XM Community
Skip to main content
Question

Aligning API responses for Survey Definition and Export Response endpoints

  • March 20, 2025
  • 1 reply
  • 15 views

Forum|alt.badge.img+5

I have noticed that the survey-definitions/{id}/questions endpoint (https://api.qualtrics.com/5d17de1a27084-example-use-cases-walkthrough#retrieve-an-existing-survey) returns question names that don’t align with the export-responses endpoint (https://api.qualtrics.com/6b00592b9c013-start-response-export). For example, when querying the survey definition, I have a question with QuestionID: QID1, DataExportTag: Email, QuestionType: TE, and then when exporting this response the field is actually called Q1D1_TEXT.

 

At the moment it looks like I will need to detect what the question type is and append the expected type to the question ID myself. Probably _1, _2... for multiple choice, matrix, rank, etc, and _TEXT for text entry. Is there a list of what suffixes I will need to do this, or a better option for finding the export names in advance?

If not, surely these should align in some way, and surely there shoud be a field in the survey definition which actually gives you the name or names of the questions as they will appear in the response export?

For reference, here is my survey definition:

{
  "response": {
    "meta": {
      "httpStatus": "200 - OK",
      "requestId": "15bc195e-6392-4501-ba7e-d05080271887"
    },
    "result": {
      "elements": [
        {
          "QuestionText": "Enter your email",
          "DefaultChoices": false,
          "DataExportTag": "Email",
          "QuestionID": "QID1",
          "QuestionType": "TE",
          "Selector": "SL",
          "DataVisibility": {
            "Private": false,
            "Hidden": false
          },
          "Configuration": {
            "QuestionDescriptionOption": "UseText"
          },
          "QuestionDescription": "Enter your email",
          "Validation": {
            "Settings": {
              "ForceResponse": "ON",
              "ForceResponseType": "ON",
              "Type": "None",
              "MinChars": "1"
            }
          },
          "GradingData": [],
          "Language": [],
          "NextChoiceId": 4,
          "NextAnswerId": 1,
          "SearchSource": {
            "AllowFreeResponse": "false"
          },
          "QuestionText_Unsafe": "Enter your email"
        }
      ]
    }
  }
}

and here is the response export (some info redacted with xxxxx):

{
  "raw_response": {
    "responses": [
      {
        "responseId": "xxxxx",
        "values": {
          "startDate": "2024-10-22T11:46:22Z",
          "endDate": "2024-10-22T11:46:31Z",
          "status": 0,
          "ipAddress": "xxxxx",
          "progress": 100,
          "duration": 9,
          "finished": 1,
          "recordedDate": "2024-10-22T11:46:31.585Z",
          "_recordId": "xxxxx",
          "recipientEmail": "xxxxx",
          "locationLatitude": "xxxxx",
          "locationLongitude": "xxxxx",
          "distributionChannel": "anonymous",
          "userLanguage": "EN-GB",
          "QID1_TEXT": "abcdef"
        },
        "labels": {
          "status": "IP Address",
          "finished": "True"
        },
        "displayedFields": [
          "QID1_TEXT"
        ],
        "displayedValues": []
      }
    ]
  }
}

any advice?

1 reply

Forum|alt.badge.img+5
  • Author
  • Level 2 ●●
  • 8 replies
  • March 20, 2025

Doesn’t look like I can delete this question, so I’ll just answer it myself, this is what the response-schema endpoint is for: https://api.qualtrics.com/9990aea44ceb4-retrieve-survey-json-schema. Still, I’d say the formatting could be better - I think a distinction between the survey metadata and the actual question responses (as featured in the platform itself) would be preferrable.


Leave a Reply