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

POST

/api-metadata/v1/{access-key}/metadata/aggregatedtables/{aggregatedTableId}/aggregatedattributes

Request Headers

Content-Type=application/json

Path Parameters
  • aggregatedTableId: The ID of the master entity to create the intelligent attribute within.

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.
  • true

  • false

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".
  • 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 .ReferenceAttribute when referencing information stored in a cube.

Specify .FunctionAttribute when performing a function in the intelligent attribute with information stored in a cube.

  • ReferenceAttribute

  • FunctionAttribute

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

atype

ctype

string

Specify atype when the attribute is being used as an AttributeValue.

Specify ctype when the attribute is being used as a CriteriaOperand.

  • .ReferenceAttribute

  • .FunctionAttribute

type string Function to perform.
  • CASE:

  • LOWER: Pick the lowest attribute value from the gathered values.

  • UPPER: Pick the highest attribute value from the gathered values.

  • CAST:

  • UNIX_TIME: Extract the unix time from the attribute.

  • TIMESTAMP: Extract the timestamp from the attribute.

  • COMPLEX_FUNCTION:

  • DISTINCT: Add to a COUNT operation to only count distinct objects.

  • DAY: Extract the day from the attribute.

  • HOUR: Extract the hour from the attribute.

  • MONTH: Extract the month from the attribute.

  • CUSTOM:

  • DIVIDE: Divide one attribute value by another attribute value (for example, "total_sms_clicked_count"/"total_sms_sent_count")

  • MULTIPLY: Multiple one attribute value with another.

attributes object

Specify an array of attributes to capture the information necessary and also the intended operation. You can also specify another .FunctionAttribute , or a .ReferenceAttribute.

You can also nest .FunctionAttributes inside other Function or Reference Attributes to perform layered operations. It's best to look at examples of existing intelligent attributes. Find one that resembles the function you are trying to achieve, and model your own intelligent attributes after it.

 

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"
  }
}

[create intelligent attribute, creating intelligent attributes, intelligent attributes, aggregated attributes]

Learn more

Intelligent attributes API

Master entities API