To add custom properties to a shopper type, issue a PUT request to the /ccadmin/v1/shopperTypes/{id}
endpoint on the administration server. Use the following format:
The request header must specify the
x-ccasset-language
value.The request body is a map where each key is the name of a new property, and each value is an object that specifies the values of the attributes of the property.
Each object is also a map, with each key being the name of an attribute and each value being the corresponding attribute value.
The following example shows a sample request for adding two custom properties to the user
shopper type:
PUT /ccadmin/v1/shopperTypes/user HTTP/1.1
Authorization: Bearer <access_token>
x-ccasset-language: en
Content-Type: application/json
{ "properties": {
"loyaltyProgramMember": {
"label": "Member of loyalty program?",
"type": "checkbox",
"uiEditorType": "checkbox",
"internalOnly": true,
"default": false,
"required": true,
},
"favoriteWebSite": {
"label": "Favorite Web Site",
"type": "shortText",
"uiEditorType": "shortText",
"internalOnly": false,
"default": null,
"required": false,
}}}
See Settable attributes of shopper type properties for information about specifying the attribute values.
The following is a portion of the response that shows the new properties:
{ ... "properties": { ... "loyaltyProgramMember": { "writable": true, "localizable": false, "label": "Member of loyalty program?", "type": "checkbox", "uiEditorType": "checkbox", "textSearchable": false, "multiSelect": null, "dimension": false, "internalOnly": true, "default": false, "editableAttributes": [ "textSearchable", "multiSelect", "dimension", "internalOnly", "default", "label", "required", "searchable" ], "length": 19, "required": true, "searchable": false }, "favoriteWebSite": { "writable": true, "localizable": false, "label": "Favorite Web Site", "type": "shortText", "uiEditorType": "shortText", "textSearchable": false, "multiSelect": null, "dimension": false, "internalOnly": false, "default": null, "editableAttributes": [ "textSearchable", "multiSelect", "dimension", "internalOnly", "default", "label", "required", "searchable" ], "length": 254, "required": false, "searchable": false }, ... } ... }