I want to batchUpsert data into Pardot by using the Pardot API 3. Single upserts work fine. Since I have a lot of data to upsert I want to use the /api/prospect/version/3/do/batchUpsert endpoint.
When I use the following code using Python3 I get a strange result I can't solve. Maybe someone knows the solution for that:
data = {"prospects": {"12345": {"website": "https://www.abcd.com"}}}
endpoint = "https://pi.pardot.com/api/prospect/version/3/do/batchUpsert"
response = requests.post(
endpoint,
headers={
"Authorization": f"Bearer {access_token}",
"Pardot-Business-Unit-Id: business_unit_id
},
json=data
}
I replaces json with data and params, that doen't matter for my problem. I receive the following error message:
{"@attributes":{"stat":"fail","version":1,"err_code":71},"err":"Input needs to be valid JSON or XML"}
The Pardot API documentation tells me to use the following syntax for a batchUpsert:
{
"prospects": {
"1234": {
"first_name": "New first name",
"last_name": "New last name"
},
"some@email.com": {
"first_name": "New first name",
"last_name": "New last name"
},
"some.other@email.com": {
"first_name": "New first name",
"last_name": "New last name"
}
}
}
I'm completely lost! Maybe someone can help?
Thanks in advance!
I tried to batchUpsert data into the pardot API 3 using Python3. I expected to see an update in the webinterface for my test prospect.