Remove Custom Attributes from a Customer
DELETE https://api.chartmogul.com/v1/customers/{CUSTOMER_UUID}/attributes/custom
Clears the values of custom attributes on a given customer.
curl -X DELETE "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": ["age", "salesRep"],
"overrides": { "custom": { "age": false } }
}'
customer = ChartMogul::Customer.retrieve("cus_de305d54-75b4-431b-adb2-eb6b9e546012")
customer.remove_custom_attributes!(:age, :salesRep)
ChartMogul.CustomAttribute.remove(
config,
"cus_de305d54-75b4-431b-adb2-eb6b9e546012",
{
custom: ["age", "salesRep"],
}
);
$customer = ChartMogul\Customer::retrieve("cus_de305d54-75b4-431b-adb2-eb6b9e546012");
$customer->removeCustomAttributes("age", "salesRep");
api.RemoveCustomAttributes(
"cus_c0dc8d74-edfd-11e6-a357-832dddba822f",
[]string{"age", "salesRep"},
)
chartmogul.CustomAttributes.remove(
config,
uuid="cus_c0dc8d74-edfd-11e6-a357-832dddba822f",
data={"custom": ["age", "salesRep"]},
)
{
"custom": {
"CAC": 213,
"utmCampaign": "social media 1",
"convertedAt": "2022-09-08 00:00:00",
"pro": false,
"channel": "Facebook"
},
"overrides": {},
"message": "Custom attributes deleted from customer"
}
{
:CAC => 213,
:utmCampaign => "social media 1",
:convertedAt => "2022-09-08 00:00:00",
:pro => false,
:channel => "Facebook",
}
{
custom: {
CAC: 213,
utmCampaign: "social media 1",
convertedAt: "2022-09-08 00:00:00",
pro: true,
channel: "Twitter"
}
}
array (
"CAC" => 213,
"utmCampaign" => "social media 1",
"convertedAt" => "2022-09-08 00:00:00",
"pro" => false,
"channel" => "Facebook"
)
(*chartmogul.CustomAttributes)(0xc04202e038)({
Custom: (map[string]interface {}) (len=5) {
(string) (len=3) "CAC": (float64) 213,
(string) (len=11) "utmCampaign": (string) (len=14) "social media 1",
(string) (len=11) "convertedAt": (string) (len=19) "2022-09-08 00:00:00",
(string) (len=3) "pro": (string) (bool) false,
(string) (len=7) "channel": (string) (len=8) "Facebook"
}
})
<CustomAttributes{
custom={
"CAC": 213,
"utmCampaign": "social media 1",
"convertedAt": "2022-09-08 00:00:00",
"pro": False,
"channel": "Facebook"
}
}>
Path parameters
customer_uuidstring required- The ChartMogul UUID of the customer.
Body parameters
customarray(string) required- An
Arraycontaining thekeys of all the custom attributes to be removed from the customer. overridesobject optional- Boolean flags for the custom attributes being removed, nested by namespace, e.g.
{"custom": {"age": false}}. Without a flag, an overridden attribute is not deleted.falseremoves the override and deletes the attribute.truedeletes the attribute and overrides its empty state, so later updates from your billing system do not restore it; it requires the attribute to exist in your account with history tracking enabled, whilefalseis always accepted.
Response
In the response, custom contains all the custom attributes now on this customer, overrides flags the currently overridden ones, and message reports the outcome, naming any overridden attributes that were kept.