cancel
Showing results for 
Search instead for 
Did you mean: 

v2/activities/addcontacts returns 400 error Unable to parse JSON payload.

SOLVED
Highlighted
Member

v2/activities/addcontacts returns 400 error Unable to parse JSON payload.

In an attempt to add some contacts to an existing list a 400 error is returned. The error in the JSON returned is:

[{"error_key":"json.payload.invalid","error_message":"Unable to parse JSON payload."}]

The JSON I'm POSTing is:

{"import_data":[{"email_addresses":["HenryDenzel@mailinator.com"],"first_name":"Denzel","last_name":"Henry","custom_fields":[{"name":"Custom Field 15","value":"Profile:105"}]},{"email_addresses":["RobertMcNamara@mailinator.com"],"first_name":"Robert","last_name":"McNamara","custom_fields":[{"name":"Custom Field 15","value":"Profile:228"}]},{"email_addresses":["JoesphStrickland@mailinator.com"],"first_name":"Joseph","last_name":"Strickland","custom_fields":[{"name":"Custom Field 15","value":"Profile:113"}]},{"email_addresses":["AshtonSykes@mailinator.com"],"first_name":"Ashton","last_name":"Sykes","custom_fields":[{"name":"Custom Field 15","value":"Profile:148"}]},{"email_addresses":["IsabellaTate@mailinator.com"],"first_name":"Isabella","last_name":"Tate","custom_fields":[{"name":"Custom Field 15","value":"Profile:96"}]},],"lists":["1954927789"],"column_names":["email","first name","last name","custom field 15"]}

The JSON correctly parses.

 

Does anyone have an idea as to why this fails?

1 REPLY 1
Moderator

Re: v2/activities/addcontacts returns 400 error Unable to parse JSON payload.

Hello,

 

Thanks for reaching out.

 

After looking over the JSON payload it appears there is a minor syntax error.

 

"value":"Profile:96"}]},],"lists":[

In this snippet you will notice right before "lists" there is }]},], and after separating everything out I found that the first , needs to be removed so the code snippet should look like this.

"value":"Profile:96"}]},],"lists":[

Or broken out line by line which is easier for me to see.

"value":"Profile:96"
            }]
    }],
    "lists":[

Regards,
Jimmy D.
Tier II API Support Engineer