I am building a small server that converts html files to pdfs and then sends a download link to qualtrics where I am able to use custom js from within my survey to click the link which then automatically downloads the pdf to a respondent's machine. I would like to upload the pdf from my server to the respondent's data, but can not find a method or API possibility for doing this. I've tried using the route below to send my pdf and am getting a 200 but there is no file there. If I can successfully upload a pdf file to a respondent's data my goal is to then have a workflow setup that sends a link to the pdf which is stored on Qualtrics to the respondent, which I know is possible from tests with upload questions. I've searched extensively through the API and can't find a method for uploading a pdf file to specific response. There isn't a method I could find for uploading a pdf using the libraries or files methods either. Any help is much appreciated. Thank you.
@app.route('/upload', methods=['POST'])
@cross_origin(origin="{QUALTRICS_URL}")
def upload_pdf():
data = request.get_json()
response_id = data['responseID']
qualtrics_key = constants.QUALTRICS_API_TOKEN
QUALTRICS_URL = 'blanking this field for privacy'
SURVEY_ID = my_survey_id
url = f'https://{QUALTRICS_URL}/API/v3/surveys/{SURVEY_ID}/responses/{response_id}/files'
headers = {
'content-type': 'application/json',
'x-api-token': qualtrics_key
}
with open("test.pdf", 'rb') as pdf_file:
files = {'file': pdf_file}
response = requests.post(url, headers=headers, files=files)
if response.status_code == 200:
print(response)
return 'File successfully uploaded'
else:
return f'Error uploading file. Status code: {response.status_code}. Error: {response.json()["meta"]["error"]}'
Can I use the Qualtrics API to upload a PDF file to a individual survey response
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
