Update a Contact
PATCH https://api.chartmogul.com/v1/contacts/{CONTACT_UUID}
Updates certain modifiable attributes of a contact object in your ChartMogul account.
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"},
],
},
)
{
"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"
}>
Body parameters
first_name
string-
The first name of the contact
last_name
string-
The last name of the contact
position
integer-
Sets the position of the contact in the UI. The first contact has a position of 1. If the number is higher than the number of contacts associated with this customer then the position itself is used as-is.
title
string-
The job title of the contact, e.g. "CEO"
email
string-
The contact's email address. Needs to be unique for the customer.
phone
string-
The contact's phone number
linked_in
string-
The URL of the contact's LinkedIn profile
twitter
string-
The URL of the contact's Twitter profile
notes
string-
Additional notes or comments about the contact. Newline can be appended with
\n
in the string. custom
object-
An array containing the custom attributes you're adding to the contact. Each custom attribute must be defined as an object with a
key
andvalue
property as described below. The key must match one of the attribute names listed under Settings & Data > Custom Attributes > Contacts. To add a custom attribute outside of this list, first create it in ChartMogul.key
string- The name of the custom attribute. Required for each custom attribute. Accepts alphanumeric characters and underscores.
value
string required- The value of the custom attribute. Required for each custom attribute. Data type can be one of
String
,Integer
,Decimal
,Timestamp
orBoolean
.
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)
Response
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.