The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

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

SOLVED
Go to solution
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 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
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

View solution in original post

1 REPLY 1
Highlighted
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

View solution in original post

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured