Creating intelligent attributes
This endpoint creates a new intelligent attribute for a specified master entity. Intelligent attributes are attributes that perform advanced or complex computations, leveraging object models (based on cubes, with their respective measures and dimensions).
Oracle Unity comes with ready-to-use intelligent attributes. Review these before creating new attributes.
Request Method | Service URL |
---|---|
|
/api-metadata/v1/{access-key}/metadata/aggregatedtables/{aggregatedTableId}/aggregatedattributes
|
Request Headers |
|
Path Parameters |
|
Request parameters
Required
Name |
Type |
Description |
Possible values |
---|---|---|---|
tenantId
|
string | Your MCPS tenant ID. | |
name
|
string | A name for the new intelligent attribute. | |
active
|
boolean | Whether the intelligent attribute is active. If false , the attribute is disabled from getting computed as part of the analytics workflow. |
|
tableId
|
string | The ID of the master entity where the intelligent attribute will be created within. For example: "MasterCustomer". | |
attributeId
|
string | Enter a unique ID to identify the intelligent attribute. For example, for the "Total Spent Amount" attribute, the attributeId is "total_spent_amt". |
|
dataSource
|
object | Specify the intelligent attribute's data sources. See below for details. | |
expression
|
object | Specify how the intelligent attribute's calculations and computations will be expressed. See below for details. |
Nested schema: dataSource
Name |
Type |
Description |
Possible values |
---|---|---|---|
type
|
string | Must be set to "cube". |
|
cubeId
|
string | The existing cube ID for the intelligent attribute. | |
modelId
|
string | The model ID associated with the cubeId . |
Nested schema: expression
Name |
Type |
Description |
Possible values |
---|---|---|---|
atype
|
string |
Specify Specify |
|
Nested schema: "atype": ".ReferenceAttribute"
. When atype
is .ReferenceAttribute
, you must specify the following attributes shown in the expression object below:
"expression": {
"atype": ".ReferenceAttribute",
"tableName": "",
"attributeName": "",
"alias": ""
}
Name |
Type |
Description |
Possible values |
---|---|---|---|
tableName
|
string | The name of the cube being referenced. Repeat the cubeId value from the dataSource parameter. |
|
attributeName
|
string | Repeat the same value as the attributeId specified above. |
|
alias
|
string | Optional. Specify an alias to identify the intelligent attribute. If omitted, the attributeName will be used. |
Nested schema: "atype": ".FunctionAttribute"
When atype
is .FunctionAttribute
, you must specify the following attributes shown in the expression object below:
"expression": {
"atype": ".FunctionAttribute",
"type": "",
"attributes": ""
}
Name |
Type |
Description |
Possible values |
---|---|---|---|
|
string |
Specify Specify |
|
type
|
string | Function to perform. |
|
attributes
|
object |
Specify an array of attributes to capture the information necessary and also the intended operation. You can also specify another You can also nest |
Examples
Create a "Most Purchased Brand" custom intelligent attribute within the Master Customer master entity. This custom intelligent attribute tracks the brand purchased most often by a customer.
POST /api-metadata/v1/e2a7a0df2410470d85ef69c8dad2bdb8/metadata/aggregatedtables/mastercustomer/aggregatedattributes
Request body:
{
"tenantId": 1,
"name": "Most Purchased Brand",
"description": "Brand purchased most often by the member",
"active": false,
"tableId": "MasterCustomer",
"attributeId": "top_brand",
"dataSource": {
"type": "cube",
"cubeId": "CA_OrderItemCube",
"modelId": "CA_OrderItemModel"
},
"expression": {
"atype": ".ReferenceAttribute",
"tableName": "CA_OrderItemCube",
"attributeName": "top_brand",
"alias": "top_brand"
}
}
Create a "Last Subscribed Event Date" custom intelligent attribute within the Master Customer master entity. This custom intelligent attribute calculates the last event date/timestamp a customer subscribed to attend.
POST /api-metadata/v1/e2a7a0df2410470d85ef69c8dad2bdb8/metadata/aggregatedtables/mastercustomer/aggregatedattributes
Request body:
{
"tenantId": 1,
"name": "Last Subscribed Event Date",
"description": "Last Subscribed Event Date",
"active": false,
"tableId": "MasterCustomer",
"attributeId": "last_subscribed_eventdate",
"dataSource": {
"type": "cube",
"cubeId": "CA_EventCube",
"modelId": "CA_EventModel"
},
"expression": {
"atype": ".FunctionAttribute",
"type": "CAST",
"attributes": [
{
"atype": ".FunctionAttribute",
"type": "UNIX_TIME",
"attributes": [
{
"atype": ".FunctionAttribute",
"type": "TIMESTAMP",
"attributes": [
{
"atype": ".FunctionAttribute",
"type": "CAST",
"attributes": [
{
"atype": ".ReferenceAttribute",
"tableName": "CA_EventCube",
"attributeName": "last_subscribed_eventdate"
},
{
"atype": ".StaticAttribute",
"data": "STRING"
}
]
},
{
"atype": ".StaticAttribute",
"data": "yyyyMMdd"
}
]
},
{
"atype": ".StaticAttribute",
"data": "yyyy-MM-dd"
}
]
},
{
"atype": ".StaticAttribute",
"data": "DATE"
}
],
"alias": "last_subscribed_eventdate"
}
}