Response Import API - CSV Upload Error | XM Community
Skip to main content

Hello Community,

I did found various posts around it but none of it has been answered:

Has anyone able to successfully import a response via Response Import API, from a CSV file? Through either webservice task or Postman or any other platform.

If yes, can you please list down detailed steps of your approach or a QSF file would be great.

It would be of great help!

 

Are you trying to upload csv from local mochine?


Yes, from a local machine 


I got that working using below Python code.

Upload API:

import requests
import json

url = 'https://fra1.qualtrics.com/API/v3/surveys/SV_XXXX/import-responses'
headers = {
'Content-Type': 'text/csv',
'charset': 'UTF-8',
'X-API-TOKEN': 'XXXX'
}
with open('upload.csv', 'rb') as file:
response = requests.post(url, headers=headers, data=file)

print(response.text)

Progress API

import requests

url = "https://fra1.qualtrics.com/API/v3/surveys/SV_XXXX/import-responses/<Progress ID>"

headers = {
"Content-Type": "application/json",
"X-API-TOKEN": "XXXX"
}

response = requests.request("GET", url, headers=headers)

print(response.text)

Make sure to use correct datacenter id as this API won’t work in proxy request. We can also combine both the code and check the progress at a fixed interval.


Leave a Reply