0

I'm interested in creating multiple new prospects from a CSV file with the batch_create method for Prospects objects in the pypardot package in Python. The method calls for the prospect information (email, name, ...) in JSON format. After reading in the csv file I'm using json.dumps() to create the JSON format but I keep on getting an

error#71: invalid JSON (http://developer.pardot.com/kb/error-codes-messages/#error-code-71).

Here is what my info looks like after json.dumps()

{"prospects": [{"first_name": "fname1", "last_name": "lname1", "email": "[email protected]"},
{"first_name": "fname2", "last_name": "lname2", "email": "[email protected]"}]}

The data type is a string.

1
  • 1
    Please try to come up with a more specific question. Asking "Any suggestions?" does not add any value.
    – Adrian Larson
    Commented Feb 9, 2018 at 1:24

1 Answer 1

0

Based on the Json samples in the documentation (api V3) and the error code, your json is incorrectly formated.

{
    "prospects": {
        "1234": {
            "first_name": "New first name",
            "last_name": "New last name"
        },
        "[email protected]": {
            "first_name": "New first name",
            "last_name": "New last name"
        },
        "[email protected]": {
            "first_name": "New first name",
            "last_name": "New last name"
        }
    }
}

if you are using the API V 4, then you need to add the square brackets as you did:

{
    "prospects": [
        {"email":"[email protected]","first_name":"First name","last_name":"Last name"},
        {"email":"[email protected]","first_name":"First name","last_name":"Last name"},
        {"email":"[email protected]","first_name":"First name","last_name":"Last name"}
    ]
}
3
  • what api version are you using?
    – glls
    Commented Feb 9, 2018 at 2:09
  • I installed pypardot4 but changed the client.py file to access version 3...
    – mango426
    Commented Feb 9, 2018 at 2:10
  • so, i updated my answer with both api version formattings
    – glls
    Commented Feb 9, 2018 at 2:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .