Create target groups

This API is used to create target groups.

Target groups are essentially the entities within which individual targets can be created. Meaning, to create targets, first target group should be created, and that can be achieved with this API.

👍

Note

For detailed information about our APIs and for hands-on testing, refer documentation in API overview and step-by-step guide on making your first API call in Make your first API call .

Prerequisites

  • Authentication: Basic/OAuth authentication
  • Default access group

Resource information

URIv3/targetGroups
HTTP methodPOST
PaginationNA
Rate limitNA
Batch supportNA

API endpoint example

https://eucrm.cc.capillarytech.com/v3/targetGroups

Request body parameters

Parameter NameData TypeDescription
activeBooleanIndicates if the tracking is active or not.
descriptionStringA brief description of the target group.
name*StringThe name identifier for the target group.
preferredTillIdNumberIdentifier for a preferred till.
trackingType*StringThe type of tracking the milestone is created for. Supported values:
Default (single target tracking),
Unified (tracking multiple targets as a unit),
Streak (Tracking the achievement of a user across the cycles continuously),
Capping (Tracking the number of points a user has got over a period, so that capping can be applied).
Non
targetEvaluationType*StringThe evaluation strategy for the targets. Supported values:
FIXED_CALENDAR_WINDOW, CYCLIC_WINDOW,
PERIOD_AGNOSTIC_WINDOW
totalPeriods*NumberThe total number of periods over which the tracking is evaluated.
frequencyType*EnumThe frequency of each cycle in which the user has to achieve the target value. Supported values: Montly, Quarterly, Half-yearly, Yearly, Weekly.
frequency*NumberThe frequency count, relevant to the frequencyType.
recurringCycles*NumberThe number of cycles for which the tracking recurs.
periodsObjectAn array of period objects, each containing details about the individual periods within the tracking.
activeBooleanIndicates if the period is active.
descriptionStringA brief description of the period.
endDateDate TimeThe end date and time of the period.
periodStatusStringIndicates if the cycle of the Milestone is active/inactive.
refCodeStringA reference code for the period.
startDateDate TimeThe start date and time of the period.
targetsObjectAn array of target objects, each outlining a target within the tracking.
activeBooleanIndicates if the target is active.
descriptionStringA brief description of the target.
expressionStringA string representing the condition to meet the target.
expressionJsonStringA JSON expression that specifies the conditions required to achieve the target.
filtersObjectAn array of filters applied to the target.
entityTypeEnumThe entity to which the specified expressions related to the target will be applied.
For example: The user has to make a purchase of shoes from ABC store. Here, purchase of shoes is the expression and the entity is ABC store.
Supported values: STORE, ZONE, CONCEPT.
entityIdsArray The IDs of the entities to which the filter applies.
nameStringThe name identifier for the target.
targetEntityEnumThe KPI on which the target is tracked.
For the transactional KPIs, the supported value for this are Transaction and Lineitem.
For the Behavioural or EMF events, the supported value is EVENT.
For the tracking based on rewards such as points, the supported value will be REWARDS.
eventNameStringThe behavioral name of the event that triggers the target.
targetTypeEnumTarget type on which the target is set.
Supported values: QUANTITY, SALES, GROSS_SALES,
REGULAR_POINTS, PROMOTIONAL_POINTS,
ALL_POINTS
For information based on configuring target based on behavioural event (COUNT, VISIT, and SUM) and EMF event (COUNT and VISIT), refer to target based on behavioural event and target based on EMF event documentation.
defaultValuesObjectAn array of objects providing default values related to the target.
defaultValueIntegerA default value used in the target evaluation.
{
    "active": true,
    "description": "Madridsta  22",
    "name": "Madridstaloyalty0211",
    "preferredTillId": 0,
    "trackingType": "DEFAULT",
    "targetEvaluationType": "FIXED_CALENDAR_WINDOW",
    "totalPeriods": 2,
    "frequencyType": "DAILY",
    "frequency": 0,
    "recurringCycles": 0,
    "periods": [
        {
            "active": true,
            "description": "pt10",
            "endDate": "2024-04-06T23:59:59.999",
            "periodStatus": "RUNNING",
            "refCode": "Madridstaloyalty022p10",
            "startDate": "2024-04-06T00:00:00.000"
        },
        {
            "active": true,
            "description": "pt11",
            "endDate": "2024-04-07T23:59:59.999",
            "periodStatus": "RUNNING",
            "refCode": "Madridstaloyalty022p11",
            "startDate": "2024-04-07T00:00:00.000"
        }
    ],
    "targets": [
        {
            "active": true,
            "description": "loyalty",
            "expression": "currentTxn.value>500",
            "expressionJson": "{\"arity\":\"binary_operation\",\"value\":\">\",\"type\":\"boolean:primitive\",\"operands\":[{\"arity\":\"object_dereference\",\"type\":\"real:object:primitive\",\"operands\":[{\"arity\":\"name\",\"value\":\"currentTxn\",\"type\":\"tx:object:primitive\"},{\"arity\":\"name\",\"value\":\"value\",\"type\":\"real:object:primitive\"}]},{\"arity\":\"literal\",\"value\":\"500\",\"type\":\"number:primitive\"}]}",
            "filters": [
                {
                    "entityType": "STORE",
                    "entityIds": [
                        50678045
                    ]
                }
            ],
            "name": "Madridstaloyalty022TXN50011",
            "targetEntity": "EVENT",
            "eventName": "removedFromCart",
            "targetType": "EVENT_ATTRIBUTE",
            "extendedFieldInfo": {
                "name": "cartId",
                "aggregateFunction": "SUM"
            },
            "defaultValues": [
                {
                    "defaultValue": 500
                },
                {
                    "defaultValue": 500
                }
            ]
        },
        {
            "active": true,
            "description": "loyalty",
            "expression": "currentTxn.value>5000",
            "expressionJson": "{\"arity\":\"binary_operation\",\"value\":\">\",\"type\":\"boolean:primitive\",\"operands\":[{\"arity\":\"object_dereference\",\"type\":\"real:object:primitive\",\"operands\":[{\"arity\":\"name\",\"value\":\"currentTxn\",\"type\":\"tx:object:primitive\"},{\"arity\":\"name\",\"value\":\"value\",\"type\":\"real:object:primitive\"}]},{\"arity\":\"literal\",\"value\":\"500\",\"type\":\"number:primitive\"}]}",
            "filters": [
                {
                    "entityType": "STORE",
                    "entityIds": [
                        50678045
                    ]
                }
            ],
            "name": "Madridstaloyaltystreak022TXN500011",
            "targetEntity": "EVENT",
            "eventName": "appInstalled",
            "targetType": "EVENT_ATTRIBUTE",
            "extendedFieldInfo": {
                "name": "deviceId",
                "aggregateFunction": "SUM"
            },
            "defaultValues": [
                {
                    "defaultValue": 500
                },
                {
                    "defaultValue": 500
                }
            ]
        }
    ]
}

Response parameters

FieldDatatypeDescription
idintegerUnique identifier for the setting/group.
namestringName of the setting/group.
activebooleanIndicates if the setting/group is active.
preferredTillIdintegerPreferred till ID, indicating no specific preference with 0.
totalPeriodsintegerTotal number of periods specified.
descriptionstringDescription of the setting/group.
targetEvaluationTypestringType of target evaluation, e.g., "FIXED_CALENDAR_WINDOW".
targetCycleStartDatestring (date-time)Start date and time for the target cycle.
targetCycleEndDatestring (date-time)End date and time for the target cycle (if applicable).
frequencyTypestringFrequency type, e.g., "CUSTOM" (if applicable).
trackingTypestringType of tracking, e.g., "STREAKS" (if applicable).
fromDatestring (date)Start date for the setting (if applicable).
toDatestring (date)End date for the setting (if applicable).
recurringCyclesintegerNumber of recurring cycles specified (if applicable).
frequencyintegerFrequency value set for the setting (if applicable).
idintegerUnique identifier for each period.
startDatestring (date)Start date for each period.
endDatestring (date)End date for each period.
refCodestringReference code for each period.
periodStatusstringStatus of each period, e.g., "RUNNING", "NOT_STARTED".
targetGroupIdintegerIdentifier linking each period to a target group.
descriptionstringDescription of each period.
activebooleanIndicates if each period is active.
idintegerUnique identifier for each streak.
namestringName of each streak.
targetCountOfSequenceintegerTarget count of sequence for each streak.
idintegerUnique identifier for each target.
namestringName of each target.
targetTypestringType of each target, e.g., "SALES".
targetEntitystringType of entity targeted by each target, e.g., "TRANSACTION".
eventNamestringName of the event associated with each target.
descriptionstringDescription of each target.
activebooleanIndicates if each target is active.
expressionstringExpression defining the criteria for each target.
expressionJsonstring (JSON)Target expression in JSON format for each target.
entityTypestringType of entity for the filter of each target, e.g., "STORE".
entityIdsarray of integersIDs of entities for the filter of each target.
enrolmentMethodstringMethod of enrolment for each target, e.g., "TRANSACTION".
defaultValuefloatSpecifies a default value for the target criteria for each target.
{
    "data": {
        "id": 32,
        "name": "TGF19",
        "fromDate": "2021-05-27",
        "toDate": "2021-05-28",
        "active": true,
        "preferredTillId": 0,
        "periods": [
            {
                "id": 74,
                "attribution": {
                    "createdOn": "2022-03-28T13:28:32.602+0000",
                    "lastUpdatedOn": "2022-03-28T13:28:32.602+0000",
                    "lastUpdatedBy": {
                        "id": 75040399,
                        "code": "bukl.till",
                        "description": "",
                        "name": "bukl.till",
                        "type": "TILL"
                    },
                    "createdBy": {
                        "id": 75040399,
                        "code": "bukl.till",
                        "description": "",
                        "name": "bukl.till",
                        "type": "TILL"
                    }
                },
                "startDate": "2022-03-29",
                "endDate": "2022-05-29",
                "refCode": "string",
                "periodStatus": "NOT_STARTED",
                "targetGroupId": 32,
                "description": "string",
                "active": true
            }
        ],
        "activePeriod": {
            "startDate": "2022-03-28",
            "endDate": "2022-04-29",
            "refCode": "gdf123",
            "periodStatus": "RUNNING",
            "description": "Samplr description",
            "active": true
        },
        "totalPeriods": 0,
        "description": "TGF19",
        "recurringCycles": 2,
        "frequency": 5,
        "targetCycleStartDate": "2021-05-28T08:41:00.529Z"
    },
    "errors": null
}
Language
Authorization
Basic
base64
:
URL
Click Try It! to start a request and see the response here!