Add Custom Attributes to a Customer

Adds custom attributes to a given customer.

Examples
curl -X POST "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": [
            {"type": "String", "key": "channel", "value": "Facebook"},
            {"type": "Integer", "key": "age", "value": 8}
          ]
         }'
customer = ChartMogul::Customer.retrieve('cus_de305d54-75b4-431b-adb2-eb6b9e546012')
customer.add_custom_attributes!(
  {type: 'String', key: 'channel', value: 'Facebook'},
  {type: 'Integer', key: 'age', value: 8}
)
ChartMogul.CustomAttribute.add(config, "cus_de305d54-75b4-431b-adb2-eb6b9e546012", {
   "custom": [
     {"type": "String", "key": "channel", "value": "Facebook"},
     {"type": "Integer", "key": "age", "value": 8}
   ]
});
<?php

$customer = ChartMogul\Customer::retrieve("cus_de305d54-75b4-431b-adb2-eb6b9e546012");
$custom = $customer->addCustomAttributes(
        ["type" => "String", "key" => "channel", "value" => "Facebook"],
        ["type" => "Integer", "key" => "age", "value" => 8]
);
?>
api.AddCustomAttributesToCustomer("cus_de305d54-75b4-431b-adb2-eb6b9e546012",
		[]*cm.CustomAttribute{
			&cm.CustomAttribute{
				Type:  "String",
				Key:   "channel",
				Value: "Facebook"},
			&cm.CustomAttribute{
				Type:  "Integer",
				Key:   "CAC",
				Value: 8},
		})
chartmogul.CustomAttributes.add(
    config,
    uuid="cus_de305d54-75b4-431b-adb2-eb6b9e546012",
    data={
        "custom": [
            {"type": "String", "key": "channel", "value": "Facebook"},
            {"type": "Integer", "key": "CAC", "value": 8}
        ]
    }
)
Result Format
{
  "custom": {
    "CAC": 213,
    "utmCampaign": "social media 1",
    "convertedAt": "2022-09-08 00:00:00",
    "pro": false,
    "salesRep": "Gabi",
    "channel": "Facebook",
    "age": 8
  }
}
{
  :CAC=> 213,
  :utmCampaign=> "social media 1",
  :convertedAt=> "2022-09-08 00:00:00",
  :pro=> false,
  :salesRep=> "Gabi",
  :channel=> "Facebook",
  :age=> 8
}
{
  "custom": {
    "CAC": 213,
    "utmCampaign": "social media 1",
    "convertedAt": "2022-09-08 00:00:00",
    "pro": false,
    "salesRep": "Gabi",
    "channel": "Facebook",
    "age": 8
  }
}
<?php

array (
  "CAC" => 213,
  "utmCampaign" => "social media 1",
  "convertedAt" => "2022-09-08 00:00:00",
  "pro" => false,"salesRep" => "Gabi",
  "channel" => "Facebook",
  "age" => 8
)
?>
(*chartmogul.CustomAttributes)(0xc04206c030)({
 Custom: (map[string]interface {}) (len=2) {
  (string) (len=3) "CAC": (float64) 8,
  (string) (len=7) "channel": (string) (len=8) "Facebook"
 }
})
<CustomAttributes{
    custom={
        'CAC': 8, 
        'channel': 'Facebook'}}>

📘

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 of TRUE, true, t, 1, FALSE, false, f, or 0.

In the response, custom contains all the custom attributes now on this customer.

Language
Authorization
Basic
base64
: