How to set contact primary address

Hi all.

I create new Contact, pass to curl following data:

$url = $baseURL . "/Contacts";
$record = array(
"date_entered" => "$dateEntered",
"assigned_user_id" => "$uid",
"created_by" => "$uid",
"team_id" => "1",
"salutation" => "$title",
"first_name" => "$firstName",
"last_name" => "$lastName",
"phone_work" => "$tel",
"phone_fax" => "$fax",
"email" => array(
array(
"email_address" => "$email",
"primary_address" => true
)
),
"primary_address_street" => "$address",
"primary_address_city" => "$city",
"primary_address_postalcode" => "$zipcode",
"primary_address_country" => "$country",
);

Record is created, all the fields, including email (in email_addresses), are populated, EXCEPT the primary address fields - they are all empty.

What do I need to do to set those fields preferably during creating a Contact if possible.

Thanks for your help,

Azriel.

Parents
  • Hi Azriel,

    This seems to work fine for me, here is a sample json payload that I used, which is exactly similar like yours:

    {
    "team_id": "1",
    "first_name": "Azriel",
    "last_name": "The Great",
    "email": [
    {
    "email_address": "azriel@azriel.com",
    "primary_address": true
    }
    ],
    "primary_address_street": "Azriel Street",
    "primary_address_city": "Azriel City",
    "primary_address_state": "Azriel State",
    "primary_address_country": "Azriel Country"
    }

    You can try checking your contact layout if you are actually displaying the primary address fields or a different set of customized fields. Or - there could also be some logic hooks or code customizations that could be wiping out your value from API. 

Reply
  • Hi Azriel,

    This seems to work fine for me, here is a sample json payload that I used, which is exactly similar like yours:

    {
    "team_id": "1",
    "first_name": "Azriel",
    "last_name": "The Great",
    "email": [
    {
    "email_address": "azriel@azriel.com",
    "primary_address": true
    }
    ],
    "primary_address_street": "Azriel Street",
    "primary_address_city": "Azriel City",
    "primary_address_state": "Azriel State",
    "primary_address_country": "Azriel Country"
    }

    You can try checking your contact layout if you are actually displaying the primary address fields or a different set of customized fields. Or - there could also be some logic hooks or code customizations that could be wiping out your value from API. 

Children
No Data