You can use the Commerce Cloud Admin API to add custom properties to the organization
item type. When you add a custom property to the organization
item type, the property is added to all accounts, including any new accounts created afterward and any accounts that already exist.
The following example illustrates using the updateItemType
endpoint to add a custom property. Note that the request header must specify the x-ccasset-language
value:
PUT /ccadmin/v1/itemTypes/organization HTTP/1.1
Authorization: Bearer <access_token>
x-ccasset-language: en
{
"id": "organization",
"specifications": [
{
"id": "customerTier",
"label": "Customer tier",
"type": "shortText",
"uiEditorType": "shortText",
"internalOnly": false,
"required": false,
"audienceVisibility": "b2b",
}
]
}
The response includes the custom property you added:
... { "writable": true, "localizable": false, "label": "Customer tier", "type": "shortText", "id": "customerTier", "uiEditorType": "shortText", "textSearchable": false, "multiSelect": null, "dimension": false, "internalOnly": false, "default": null, "editableAttributes": [ "textSearchable", "multiSelect", "dimension", "internalOnly", "default", "label", "required", "searchable" "audienceVisibility" ], "length": 254, "required": false, "searchable": false }, ...
The
is the string that determines whether the property appears as a choice in the Attributes field of the audience interface. For account properties, this value should be set to b2b
. See Define Audiences in Using Oracle Commerce Cloud.
You can create a new account and set the values of custom properties (as well as the predefined properties) using the createOrganization
endpoint. To set a custom property on an existing account, use the updateOrganization
endpoint. For example:
PUT /ccadmin/v1/organizations/100001 HTTP/1.1
Authorization: Bearer <access_token>
{
"customerTier": "silver"
}