create-profile

Description

The create-profile command creates a new profile in the system. It requires a JSON payload file that defines the profile configuration.

Syntax

Windows

CliTool.bat create-profile -f <path_to_json_file>

Linux

./CliTool.sh create-profile -f <path_to_json_file>

Example

Windows

CliTool.bat create-profile -f C:\profiles\create_profile.json

How to prepare the create-profile JSON payload

Before creating a profile, use the following helper commands to prepare a valid payload.

  1. Step 1: Get datasource names

    CliTool.bat get-all-datasource-names-for-logged-in-user

    Use one of the returned datasource names as the value of dataSourceName.

  2. Step 2: Get tables for a datasource

    CliTool.bat search-table -d <dataSourceName>

    Example:

    CliTool.bat search-table -d UnicaDetectDS

    Use one of the returned table names as the value of dbTableName.

  3. Step 3: Get default attribute-column mappings

    CliTool.bat get-default-attribute-column-mapping -d <dataSourceName> -t <tableName>
    Example:
    CliTool.bat get-default-attribute-column-mapping -d UnicaDetectDS -t CUSTOMER_PROFILE

    This returns default attributeColumnMappings. Start from that output and edit only these fields as needed:

    • attributeName
    • isKeyAttribute
  4. Step 4: Build the payload

    While building the JSON payload:

    • set dataSourceName using a value returned by get-all-datasource-names-for-logged-in-user
    • set dbTableName using a value returned by search-table
    • set attributeColumnMappings using the response from get-default-attribute-column-mapping
    • set exactly one mapping with "isKeyAttribute": true
    • set keyAttributeColumn to the corresponding database column name
    • set top-level keyAttribute to the business attribute name of the key mapping
    • if this is the first profile in the system, set "isMasterProfile": true
    • set "isMasterTable": true

JSON Payload Example

{
  "name": "Customer",
  "description": "Master profile for customer data",
  "keyAttribute": "AUDIENCE_KEY",
  "isMasterProfile": true,
  "profileTables": [
    {
      "dataSourceName": "UnicaDetectDS",
      "dbTableName": "customer_profile",
      "keyAttributeColumn": "AUDIENCE_KEY",
      "isMasterTable": true,
      "attributeColumnMappings": [
        {
          "databaseColumn": {
            "name": "AUDIENCE_KEY",
            "typeCode": 12,
            "isPrimaryKey": false
          },
          "attributeName": "AUDIENCE_KEY",
          "isKeyAttribute": true
        },
        {
          "databaseColumn": {
            "name": "firstName",
            "typeCode": 12,
            "isPrimaryKey": false
          },
          "attributeName": "firstName",
          "isKeyAttribute": false
        },
        {
          "databaseColumn": {
            "name": "lastName",
            "typeCode": 12,
            "isPrimaryKey": false
          },
          "attributeName": "lastName",
          "isKeyAttribute": false
        },
        {
          "databaseColumn": {
            "name": "city",
            "typeCode": 12,
            "isPrimaryKey": false
          },
          "attributeName": "city",
          "isKeyAttribute": false
        },
        {
          "databaseColumn": {
            "name": "mobileNumber",
            "typeCode": 12,
            "isPrimaryKey": false
          },
          "attributeName": "mobileNumber",
          "isKeyAttribute": false
        }
      ]
    }
  ]
}
Important: dataSourceName, dbTableName, and attributeColumnMappings should be derived from the helper commands above rather than guessed manually.

JSON Schema Breakdown

Field Data Type Required Description
name String Yes Name of the profile
description String No Brief description of the profile
keyAttribute String Yes Business attribute in feed data used as the profile key
isMasterProfile Boolean Yes Indicates whether this is the master profile
profileTables Array Yes List of profile tables; currently exactly one is supported
dataSourceName String Yes Datasource name
dbTableName String Yes Database table name
keyAttributeColumn String Yes Database column acting as key column
isMasterTable Boolean Yes Must be true in the current implementation
attributeColumnMappings Array Yes Mapping of database columns to profile attributes
databaseColumn Object Yes Details of the database column
attributeName String Yes Target profile attribute name
isKeyAttribute Boolean Yes Whether the mapping is the key attribute