put https://api.chartmogul.com/v1/customers//attributes/custom
Updates the custom attributes of a given customer. Attribute must first be created using the POST call.
Examples
curl -X PUT "https://api.chartmogul.com/v1/customers/cus_de305d54-75b4-431b-adb2-eb6b9e546012/attributes/custom" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"custom":{
"pro": true,
"channel": "Twitter"
}
}'
customer = ChartMogul::Customer.retrieve('cus_de305d54-75b4-431b-adb2-eb6b9e546012')
customer.update_custom_attributes!(
pro: true,
channel: "Twitter"
)
ChartMogul.CustomAttribute.update(config, "cus_de305d54-75b4-431b-adb2-eb6b9e546012", {
"custom": {
"pro": true,
"channel": "Twitter"
}
}, function (err, res) {
// asynchronously called
});
<?php
$customer = ChartMogul\Customer::retrieve(
"cus_de305d54-75b4-431b-adb2-eb6b9e546012");
$customer->updateCustomAttributes(
["channel" => "Twitter"],
["pro" => true]
);
?>
api.UpdateCustomAttributesOfCustomer(
"cus_c0dc8d74-edfd-11e6-a357-832dddba822f",
map[string]interface{}{
"channel": "Twitter",
})
chartmogul.CustomAttributes.update(
config,
uuid="cus_c0dc8d74-edfd-11e6-a357-832dddba822f",
data={"custom": {
"channel": "Twitter"
}
}
)
Result Format
{
"custom": {
"CAC": 213,
"utmCampaign": "social media 1",
"convertedAt": "2015-09-08 00:00:00",
"pro": true,
"channel": "Twitter"
}
}
{
:CAC=> 213,
:utmCampaign=> "social media 1",
:convertedAt=> "2015-09-08 00:00:00",
:pro=> true,
:salesRep=> "Gabi",
:channel=> "Twitter",
:age=> 8
}
{
"custom": {
"CAC": 213,
"utmCampaign": "social media 1",
"convertedAt": "2015-09-08 00:00:00",
"pro": true,
"channel": "Twitter"
}
}
<?php
array (
"CAC" => 213,
"utmCampaign" => "social media 1",
"convertedAt" => "2015-09-08 00:00:00",
"pro" => true,
"channel" => "Twitter"
)
?>
(*chartmogul.CustomAttributes)(0xc04206e030)({
Custom: (map[string]interface {}) (len=2) {
(string) (len=3) "CAC": (float64) 8,
(string) (len=7) "channel": (string) (len=7) "Twitter"
}
})
<CustomAttributes{
custom={
'CAC': 8,
'channel': 'Twitter'}}>
Note that each attribute has to be already present, non-existent attributes will result in Bad request
.
Supported data types and their accepted formats
String
- Accepts alphanumeric characters. Maximum of 255 characters allowed.
Integer
- Accepts only numeric characters .
Decimal
- Accepts floating point numbers.
Timestamp
- In the ISO 8601 format.
Boolean
- Can be one ofTRUE
,true
,t
,1
,FALSE
,false
,f
, or0
.
In the response, custom
contains all the custom attributes now on this customer.