We didn’t have that header in there, but I added it and it’s the exact same result. It’ll mark any attached contacts as deleted, then add an empty record new contact.
Here’s the updated header that we’re including:
const headers = {
'X-Api-Secret': 'password',
'X-Api-Token': 'TOKER-ID-HERE',
'X-Requested-With': 'XMLHttpRequest',
}
Here’s the console.log(client.data)
:
INFO { id: 'm-------------0',
user_id: 'V-----------m',
assigned_user_id: '',
name: 'Grey Sky Media',
website: 'https://greyskymedia.com',
private_notes: '',
balance: 0,
group_settings_id: '',
paid_to_date: 0,
credit_balance: 0,
last_login: 0,
size_id: '',
public_notes: '',
client_hash: 'B---------------------------9',
address1: '5701 Lonetree Blvd',
address2: '#315',
phone: '',
city: 'Rocklin',
state: 'CA',
postal_code: '95765',
country_id: '840',
industry_id: '',
custom_value1: '',
custom_value2: '',
custom_value3: '',
custom_value4: '',
shipping_address1: '5701 Lonetree Blvd',
shipping_address2: '#315',
shipping_city: 'Rocklin',
shipping_state: 'CA',
shipping_postal_code: '95765',
shipping_country_id: '',
settings:
{ language_id: '1',
currency_id: '1',
payment_terms: '0',
valid_until: '30',
default_task_rate: 000 },
is_deleted: false,
vat_number: '',
id_number: '66421',
updated_at: 1631719427,
archived_at: 0,
created_at: 1630359874,
display_name: 'Grey Sky Media',
number: '00004',
contacts:
[ { id: 'GELe32Qd69',
first_name: 'Jamison',
last_name: 'Mergens',
email: '[email protected]',
created_at: 1630688732,
updated_at: 1631719426,
archived_at: 0,
is_primary: true,
is_locked: false,
phone: '(916) 234-0040',
custom_value1: '',
custom_value2: '',
custom_value3: '',
custom_value4: '',
contact_key: 'w---------------------------d',
send_email: true,
last_login: 0,
password: '',
link:
'https://URL-HERE.com/client/key_login/w---------------------------d' },
{ id: 'K-----------L',
first_name: '222',
last_name: '222',
email: '[email protected]',
created_at: 1631551570,
updated_at: 1631719427,
archived_at: 0,
is_primary: false,
is_locked: false,
phone: '(916) 234-0040',
custom_value1: '',
custom_value2: '',
custom_value3: '',
custom_value4: '',
contact_key: 'q---------------------------4',
send_email: true,
last_login: 0,
password: '',
link:
'https://portal.greyskymedia.com/client/key_login/q---------------------------4' },
{ first_name: '000',
last_name: '000',
email: '[email protected]',
phone: '+000 000 000-0000' } ],
documents: [],
gateway_tokens: [] }
And the client.data.contacts.map(console.log)
:
INFO { id: 'K-------------L',
first_name: '222',
last_name: '222',
email: '[email protected]',
created_at: 1631551570,
updated_at: 1631719065,
archived_at: 0,
is_primary: false,
is_locked: false,
phone: '(916) 234-0040',
custom_value1: '',
custom_value2: '',
custom_value3: '',
custom_value4: '',
contact_key: 'q-------------------------------4',
send_email: true,
last_login: 0,
password: '',
link:
'https://URL-HERE.com/client/key_login/q--------------------------------4' } 1 [ { id: 'G----------9',
first_name: '111',
last_name: '111',
email: '[email protected]',
created_at: 1630688732,
updated_at: 1631719065,
archived_at: 0,
is_primary: true,
is_locked: false,
phone: '(916) 234-0040',
custom_value1: '',
custom_value2: '',
custom_value3: '',
custom_value4: '',
contact_key: 'w---------------------------d',
send_email: true,
last_login: 0,
password: '',
link:
'https://URL-HERE.com/client/key_login/w-----------------------------d' },
{ id: 'K------------L',
first_name: '000',
last_name: '000',
email: '[email protected]',
created_at: 1631551570,
updated_at: 1631719065,
archived_at: 0,
is_primary: false,
is_locked: false,
phone: '(916) 234-0040',
custom_value1: '',
custom_value2: '',
custom_value3: '',
custom_value4: '',
contact_key: 'q-------------------------------4',
send_email: true,
last_login: 0,
password: '',
link:
'https://URL-HERE.com/client/key_login/q--------------------------4' },
{ first_name: '000',
last_name: '000',
email: '[email protected]',
phone: '+000 000 000-0000' } ]