Create bucket attributes
This endpoint creates a new bucket attribute for a specified master entity.
Bucket Attributes group data according to rules you specify. Bucket attributes are based on another attribute (either a data object or an aggregated attribute).
For example, "age_bands" is a bucket attribute, based on the age attribute, that groups customers by their age into the following buckets:
-
Under 18
-
18-44
-
45-64
-
65+
| Request Method | Service URL |
|---|---|
|
|
/api-metadata/v1/{access-key}/metadata/aggregatedtables/{aggregatedTableId}/buckets
|
|
Request Headers |
|
| Path Parameters |
|
Request parameters
|
Name |
Type |
Required? |
Description |
Possible values |
|---|---|---|---|---|
tenantId
|
String | Yes | Your MCPS tenant ID. | |
name
|
String | Yes | A name for the new bucket attribute. | |
description
|
String | No | Enter a description for the bucket attribute. | |
active
|
Boolean | Yes | Whether the bucket attribute is active. If false, the attribute is disabled from getting computed as part of the analytics workflow. |
|
tableId
|
String | Yes | The ID of the master entity where the bucket attribute will be created within. For example: "MasterCustomer". | |
bucketingId
|
String | Yes | Enter a unique ID to identify the bucket attribute. For example, for the "Age group bands" attribute, the bucketingId is "age_bands". |
|
attribute
|
Object | Yes | Specify the base attribute that the bucket attribute refers to. For example, if the bucket attribute will be used to put the customer into an age bracket, then the base attribute would be the name of an age attribute in the master entity. See below for details. | |
type
|
String | Yes | Specify the bucket attribute type. Refer to Configuring bucket attributes to learn how to configure each type. |
|
configs
|
Object | Yes | Specifies the bucket attribute's ranges. Refer to Configuring bucket attributes for more details. |
Nested schema: attribute
|
Name |
Type |
Description |
Possible values |
|---|---|---|---|
atype
|
String | The bucket attribute type. Must be .ReferenceAttribute. |
|
tableName
|
String | The name of the data object to reference. | |
attributeName
|
String | The name of the attribute to reference. |
Examples
Create a bucket attribute for the "mastercustomer" master entity to group the "Percent of money spent, returned". This bucket attribute calculates the Total Money Received from Returns, divided by the Total Money Spent. The grouping follows:
-
0-10% Lowest
-
10-25% Low
-
25-75% Average
-
75-90% High
-
90-100% Highest
POST /api-metadata/v1/e2a7a0df2410470d85ef69c8dad2bdb8/metadata/aggregatedtables/mastercustomer/buckets
Request body:
{
"tenantId": 1,
"name": "Percent of Money Spent, Returned Bands",
"active": false,
"tableId": "MasterCustomer",
"bucketingId": "percent_return_value_purchased_bands",
"attribute": {
"atype": ".ReferenceAttribute",
"tableName": "MasterCustomer",
"attributeName": "percent_return_value_purchased"
},
"type": "PERCENTILE",
"configs": [
{
"lowerBound": {
"atype": ".RangeAttribute",
"data": 0,
"type": "INCLUSIVE"
},
"upperBound": {
"atype": ".RangeAttribute",
"data": 10,
"type": "INCLUSIVE"
},
"rangeValue": {
"atype": ".StaticAttribute",
"data": "Lowest"
}
},
{
"lowerBound": {
"atype": ".RangeAttribute",
"data": 10,
"type": "EXCLUSIVE"
},
"upperBound": {
"atype": ".RangeAttribute",
"data": 25,
"type": "INCLUSIVE"
},
"rangeValue": {
"atype": ".StaticAttribute",
"data": "Low"
}
},
{
"lowerBound": {
"atype": ".RangeAttribute",
"data": 25,
"type": "EXCLUSIVE"
},
"upperBound": {
"atype": ".RangeAttribute",
"data": 75,
"type": "INCLUSIVE"
},
"rangeValue": {
"atype": ".StaticAttribute",
"data": "Average"
}
},
{
"lowerBound": {
"atype": ".RangeAttribute",
"data": 75,
"type": "EXCLUSIVE"
},
"upperBound": {
"atype": ".RangeAttribute",
"data": 90,
"type": "INCLUSIVE"
},
"rangeValue": {
"atype": ".StaticAttribute",
"data": "High"
}
},
{
"lowerBound": {
"atype": ".RangeAttribute",
"data": 90,
"type": "EXCLUSIVE"
},
"upperBound": {
"atype": ".RangeAttribute",
"data": 100,
"type": "INCLUSIVE"
},
"rangeValue": {
"atype": ".StaticAttribute",
"data": "Highest"
}
}
]
}