Error in adding address while creating new contact

perquey
Participant

Error in adding address while creating new contact

I am having problem adding address to contact when creating it. Using the SDK provided by company i.e. v2 of API I called

 

$address = array('name'=>'country', 'value'=>'US'); or $address=array("country"=>"Us", "state_code"=>"AL");
$contact->addAddress(Address::create($address));

 

but it returns error: 

 

Array
(
    [0] => Array
        (
            [error_key] => json.max.items.violation
            [error_message] => #/addresses: 3 items were contained, but the maximum number of items allowed is 2.
        )

)
1 REPLY 1
DaveBerard
Moderator

The error means that there are 3 address objects in the addresses array and we only support a maximum of two (one home and one work).  I believe the explanation for your problem is the same as in this thread: http://community.constantcontact.com/t5/Getting-Started-with-API-s/Contacts-and-the-new-API-How-to-d...

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page