patch https://api.chartmogul.com/v1/contacts/
Updates certain modifiable attributes of a contact
object in your ChartMogul account.
Example
curl -X PATCH "https://api.chartmogul.com/v1/contacts/con_f90ba380-57a8-11ee-9500-7f50256329a7" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"first_name": "Bill",
"last_name": "Thompson",
"position": 10,
"title": "CTO",
"email": "[email protected]",
"phone": "+987654321",
"linked_in": "https://linkedin.com/example",
"twitter": "https://twitter.com/example",
"notes": "New Heading\nNew Body\nNew Footer",
"custom": [
{ "key": "Facebook", "value": "https://www.facebook.com/example" },
{ "key": "date_of_birth", "value": "1990-01-01" }
]
}'
contact = ChartMogul::Contact.retrieve("con_f90ba380-57a8-11ee-9500-7f50256329a7")
contact.first_name = "Bill"
contact.last_name = "Thompson"
contact.email = "[email protected]"
contact.title = "CTO"
contact.position = 10
contact.phone = "+987654321"
contact.linked_in = "https://linkedin.com/example"
contact.twitter = "https://twitter.com/example"
contact.notes = 'New Heading\nNew Body\nNew Footer'
contact.custom = {
Facebook: "https://facebook.com/example",
date_of_birth: "1990-01-01",
}
contact.update!
const contactUuid = "con_f90ba380-57a8-11ee-9500-7f50256329a7";
const data = {
first_name: "Bill",
last_name: "Thompson",
position: 10,
title: "CTO",
email: "[email protected]",
phone: "+987654321",
linked_in: "https://linkedin.com/example",
twitter: "https://twitter.com/example",
notes: "New Heading\nNew Body\nNew Footer",
custom: [
{ key: "Facebook", value: "https://www.facebook.com/example" },
{ key: "date_of_birth", value: "1990-01-01" },
],
};
ChartMogul.Contact.modify(config, contactUuid, data);
ChartMogul\Contact::update(
["contact_uuid" => "con_f90ba380-57a8-11ee-9500-7f50256329a7"],
[
"first_name" => "Bill",
"last_name" => "Thompson",
"position" => 10,
"title" => "CTO",
"email" => "[email protected]",
"phone" => "+987654321",
"linked_in" => "https://linkedin.com/example",
"twitter" => "https://twitter.com/example",
"notes" => "New Heading\nBody\nFooter",
"custom" => [
["key" => "Facebook", "value" => "https://www.facebook.com/example"],
["key" => "date_of_birth", "value" => "1990-01-01"]
],
]
);
api.UpdateContact(&cm.UpdateContact{
FirstName: "Bill",
LastName: "Thompson",
LinkedIn: "https://linkedin.com/example",
Notes: "New Heading\nNew Body\nNew Footer",
Phone: "+987654321",
Position: 10,
Title: "CTO",
Twitter: "https://twitter.com/example",
Custom: []cm.Custom{
{
Key: "Facebook",
Value: "https://www.facebook.com/example",
},
{
Key: "date_of_birth",
Value: "1990-01-01",
},
},
}, "con_f90ba380-57a8-11ee-9500-7f50256329a7")
chartmogul.Contact.modify(
config,
uuid="con_f90ba380-57a8-11ee-9500-7f50256329a7",
data={
"first_name": "Bill",
"last_name": "Thompson",
"position": 10,
"title": "CTO",
"email": "[email protected]",
"phone": "+987654321",
"linked_in": "https://linkedin.com/example",
"twitter": "https://twitter.com/example",
"notes": "New Heading\nNew Body\nNew Footer",
"custom": [
{"key": "Facebook", "value": "https://www.facebook.com/example"},
{"key": "date_of_birth", "value": "1990-01-01"},
],
},
)
Result Format
{
"uuid": "con_f90ba380-57a8-11ee-9500-7f50256329a7",
"customer_uuid": "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
"customer_external_id": "customer_001",
"data_source_uuid": "ds_a0767e0a-515b-11ee-b531-07b8fff1bb01",
"first_name": "Bill",
"last_name": "Thompson",
"position": 10,
"title": "CTO",
"email": "[email protected]",
"phone": "+9876543210",
"linked_in": "https://linkedin.com/example",
"twitter": "https://twitter.com/example",
"notes": "New Heading\nNew Body\nNew Footer",
"custom": [
{ "key": "Facebook", "value": "https://www.facebook.com/example" },
{ "key": "date_of_birth", "value": "1990-01-01" }
]
}
#<ChartMogul::Contact:0x0000000128fada38
@custom={
:Facebook=>"https://facebook.com/example",
:date_of_birth=>"1990-01-01"
},
@customer_external_id="customer_001",
@customer_uuid="cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
@data_source_uuid="ds_a0767e0a-515b-11ee-b531-07b8fff1bb01",
@email="[email protected]",
@first_name="Bill",
@last_name="Thomposon",
@linked_in="https://linkedin.com/example",
@notes="New Heading\nBody\nFooter",
@phone="+987654321",
@position=10,
@title="CTO",
@twitter="https://twitter.com/example",
@uuid="con_f90ba380-57a8-11ee-9500-7f50256329a7"
>
{
uuid: "con_f90ba380-57a8-11ee-9500-7f50256329a7",
customer_uuid: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
customer_external_id: "customer_001",
data_source_uuid: "ds_a0767e0a-515b-11ee-b531-07b8fff1bb01",
first_name: "Bill",
last_name: "Thompson",
position: 10,
title: "CTO",
email: "[email protected]",
phone: "+9876543210",
linked_in: "https://linkedin.com/example",
twitter: "https://twitter.com/example",
notes: "New Heading\nNew Body\nNew Footer",
custom: [
{ key: Facebook, value: "https://www.facebook.com/example" },
{ key: date_of_birth, value: "1990-01-01" }
]
}
class ChartMogul\Contact (15) {
protected $uuid => string(40) "con_f90ba380-57a8-11ee-9500-7f50256329a7"
protected $customer_uuid => string(40) "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0"
protected $data_source_uuid => string(39) "ds_a0767e0a-515b-11ee-b531-07b8fff1bb01"
protected $customer_external_id => string(5) "customer_001"
protected $first_name => string(4) "Bill"
protected $last_name => string(8) "Thompson"
protected $position => int(10)
protected $email => string(16) "[email protected]"
protected $title => string(3) "CTO"
protected $notes => string(23) "New Heading\nBody\nFooter"
protected $phone => string(10) "+987654321"
protected $linked_in => string(34) "https://linkedin.com/example"
protected $twitter => string(32) "https://twitter.com/example"
protected $custom => array(2) {
"Facebook" => string(38) "https://www.facebook.com/example"
"date_of_birth" => string(10) "1990-01-01"
}
}
(*chartmogul.Contact)(0x1400018a300)({
UUID: (string) (len=40) "con_f90ba380-57a8-11ee-9500-7f50256329a7",
CustomerExternalID: (string) (len=12) "customer_001",
CustomerUUID: (string) (len=40) "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
DataSourceUUID: (string) (len=39) "ds_a0767e0a-515b-11ee-b531-07b8fff1bb01",
FirstName: (string) (len=4) "Bill",
LastName: (string) (len=8) "Thompson",
LinkedIn: (string) (len=34) "https://linkedin.com/example",
Notes: (string) (len=31) "New Heading\nNew Body\nNew Footer",
Phone: (string) (len=10) "+987654321",
Position: (uint32) 10,
Title: (string) (len=3) "CTO",
Twitter: (string) (len=32) "https://twitter.com/example",
Custom: (map[string]interface {}) (len=2) {
(string) (len=8) "Facebook": (string) (len=35) "https://www.facebook.com/example",
(string) (len=13) "date_of_birth": (string) (len=10) "1990-01-01"
}
})
<Contact{
custom={"Facebook": "https://www.facebook.com/example","date_of_birth": "1990-01-01"},
customer_external_id="external_001",
customer_uuid="cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
data_source_uuid="ds_a0767e0a-515b-11ee-b531-07b8fff1bb01",
email="[email protected]",
first_name="Bill",
last_name="Thompson",
linked_in="https://linkedin.com/example",
notes="New Heading\nNew Body\nNew Footer",
phone="+987654321",
position=10,
title="CTO",
twitter="https://twitter.com/example"
uuid="con_f90ba380-57a8-11ee-9500-7f50256329a7"
}>
Adding new custom attributes
It is currently not possible to add new custom attributes through the API. Only custom attributes that are already defined may be added (regardless of whether or not they have a value for a contact)
In the response, the JSON
object contains the following data:
uuid
: The UUID of the contact.customer_uuid
: The UUID of the customer to which this contact belongs.customer_external_id
: The external id of the customer to which this contact belongs.data_source_uuid
: The UUID of the data source of the customer to which this contact belongs. A user can have multiple data sources, and the contact should only be associated to one of them.position
: Position of the contact in the customer’s profile.first_name
: The first name of the contact.last_name
: The last name of the contact.title
: The job title of the contact.email
: The email address of the contact.phone
: The phone number of the contact.linked_in
: The URL of the contact's LinkedIn profile.twitter
: The URL of the contact's Twitter profile.notes
: Additional notes or comments about the contact.custom
: A dictionary of custom fields and their values that are specific to this contact. If no custom attributes are set to a contact, this will be an empty object.