cancel
Showing results for 
Search instead for 
Did you mean: 

Contacts V2 API - JSON Max Items Violation for Addresses Property

Highlighted
Occasional Visitor

Contacts V2 API - JSON Max Items Violation for Addresses Property

Attempting to use the "Contacts" API method from the V2 API, and looking to add some postal information with the incoming records. Here is an example post with sensitive information redacted:

 

{
"lists": [
{
"id": "1376827320"
}
],
"email_addresses": [
{
"email_address": "xxxxxxx@hotmail.com"
}
],
"addresses": [
{
"address_type": "PERSONAL"
},
{
"city": "Test"
},
{
"postal_code": "12345"
},
{
"state": "OH"
},
{
"line1": "820 W Test Lake Rd"
}
],
"first_name": "John",
"last_name": "Test"
}

 

And this is what I am getting in the HTTP Response, as part of a HTTP 400 error:

 

[
{
"error_key": "json.max.items.violation",
"error_message": "#/addresses: 5 items were contained, but the maximum number of items allowed is 2."
}
]

 

If I am reading this correctly, the HTTP response is claiming we can't add more than two parameters as part of the address property. And since the address_type is required, it really means we can only add one. I'm assuming I must be missing something because this doesn't seem correct. This is for a brand new record, the email does not exist at all in Constant Contact. Any ideas?

2 REPLIES 2
Moderator

Re: Contacts V2 API - JSON Max Items Violation for Addresses Property

Hi @brooklynf1,

 

Thank you for reaching out to Constant Contact's API Support.

 

The issue is a syntax problem. In your example you are putting {} around each data pair. For example you have {"city": "Test"}. That is actually part of the "addresses" object so the {} are already in place. Please take a look at the below example using your data.

 

{
"lists": [
  {
"id": "1376827320"
} ], "email_addresses": [ {
"email_address": "xxxxxxx@hotmail.com"
} ], "addresses": [ { "address_type": "PERSONAL", "city": "Test", "postal_code": "12345", "state": "OH", "line1": "820 W Test Lake Rd" } ], "first_name": "John", "last_name": "Test" }

Regards,
Jimmy D.
Tier II API Support Engineer
Occasional Visitor

Re: Contacts V2 API - JSON Max Items Violation for Addresses Property

My mistake- thank you for your help!