I'm trying to write a Python script that imports a mailing list from a CSV file straight to a Qualtrics mailing list. I have the Qualtrics API and have only managed to import one contact. Is it possible to import multiple contacts at once? My script currently looks like this:
import requests
import pandas as pd
df = pd.read_csv("<filepath\\maillist.csv>", index_col=None)
apiToken = "<apiToken>"
baseUrl = "<https://qualtrics.com/maillist>"
headers = {
"x-api-token": apiToken,
"Content-Type": "application/json"
}
json = pd.DataFrame.to_json(df)
response = requests.post(baseUrl, json=data, headers=headers)
print(response.text)
The CSV contains these columns: Email Address, First Name, Last Name, ExternalID and Language.
There are two rows of data however when I run the above script it will only send across the first row.
Any ideas how to send across multiple rows?
Page 1 / 1
hi willd9
did you ever get an answer to this or figure it out? if so, can you post it on here :)
thanks
Ben
I hate to resurrect a dead thread, but I'm struggling to find a more recent post on this topic. I've been able to load a CSV, convert to JSON, and then upload via the API. But it is an iterative process and doesn't batch load the contacts. willd9 did you ever get this to work on more than one row?
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.