Retrieve particular question responses from API | XM Community
Skip to main content
Question

Retrieve particular question responses from API


I am having a hard time scripting the appropriate string for pulling particular questions from the API into a CSV.

I am using the example script, in python, which worked great for dumping the whole dataset. But for the CSV, I only need certain questions for another project. I've gotten a variety of errors, but usually, it's the "results" text response.



Here is an example of what I tried to force without success. Any tips would be greatly appreciated.



downloadRequestUrl = baseUrl

downloadRequestPayload = '{"format":"' + fileFormat + '","surveyId":"' + surveyId + '","questionId":"' + ["QID28", "QID10"] + '"}'

downloadRequestResponse = requests.request("POST", downloadRequestUrl, data=downloadRequestPayload, headers=headers)

progressId = downloadRequestResponse.json()["result"]["id"]

print(downloadRequestResponse.text)
Be the first to reply!

Leave a Reply