Get target events

Get events that are associated with a target or streak

This API fetches the events that are associated with a target or streak for a customer. Enter a userId (customer Id) and the targetRuleId of the target the customer is enrolled in to fetch the data of the customer events (behavioural and non-behavioural).

👍

Note

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

Prerequisites

  • Authentication: Basic/OAuth authentication
  • Default access group

Resource Information

URIv3/users/{userId}/trackedTargetEvents/{targetRuleId}
HTTP methodGET
PaginationYes. Sorting is not supported. Results are displayed in chronological order.
Rate limitNA
Batch supportNA

API endpoint example

https://eu.api.capillarytech.com/v3/users/387538614/trackedTargetEvents/79196

Path parameters

Parameter NameData TypeDescription
userIdLongUnique ID of the customer.
targetRuleIdLongUnique ID of the target rule.

Use the Get associated target groups of a user API to fetch the targetRuleId for a customer enrolled in a milestone / target.

Query parameters

Parameter NameData TypeDescription
periodIdLongUnique ID of the target period. Provide a periodId to filter events for a specific time period / target cycle within the target.

Use the Get target periods API and use the targetGroupId of the target to fetch the periodIdfor a customer enrolled in a milestone / target.
limitIntegerNumber of events to display per page. For example, if the total events are 15 and the limit is 5, the first page will display the first 5 events .
offsetIntegerPage number to retrieve. To view the first page, set the value to 0.

Response body

{
    "pagination": {
        "limit": 10,
        "offset": 0,
        "total": 10
    },
    "data": [
        {
            "eventLogId": 606066681,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "880613909",
            "eventDate": "2025-01-09 12:00:12.0",
            "eventProcessedDate": "2025-01-09 12:00:12.0",
            "periodId": 9887,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 1000
        },
        {
            "eventLogId": 606066721,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "880613938",
            "eventDate": "2025-01-09 12:00:12.0",
            "eventProcessedDate": "2025-01-09 12:00:12.0",
            "periodId": 9887,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 2000
        },
        {
            "eventLogId": 606068043,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "880614460",
            "eventDate": "2025-01-09 12:00:12.0",
            "eventProcessedDate": "2025-01-09 12:00:12.0",
            "periodId": 9887,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 2000
        },
        {
            "eventLogId": 606072487,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "880616667",
            "eventDate": "2025-01-09 13:00:12.0",
            "eventProcessedDate": "2025-01-09 13:00:12.0",
            "periodId": 9887,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 2000.46
        },
        {
            "eventLogId": 608082820,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "880897427",
            "eventDate": "2025-01-09 13:00:12.0",
            "eventProcessedDate": "2025-01-09 13:00:12.0",
            "periodId": 9887,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 2000.46
        },
        {
            "eventLogId": 615116253,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "881039056",
            "eventDate": "2025-01-20 13:00:00.0",
            "eventProcessedDate": "2025-01-20 13:00:00.0",
            "periodId": 9888,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 999.54
        },
        {
            "eventLogId": 615376598,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "881070102",
            "eventDate": "2025-01-21 09:00:00.0",
            "eventProcessedDate": "2025-01-21 09:00:00.0",
            "periodId": 9888,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 2000
        },
        {
            "eventLogId": 615376684,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "881070130",
            "eventDate": "2025-01-21 09:00:00.0",
            "eventProcessedDate": "2025-01-21 09:00:00.0",
            "periodId": 9888,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 1000
        },
        {
            "eventLogId": 615460983,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "881101809",
            "eventDate": "2025-01-22 14:00:00.0",
            "eventProcessedDate": "2025-01-22 14:00:00.0",
            "periodId": 9889,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 1000
        },
        {
            "eventLogId": 615461137,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "881101873",
            "eventDate": "2025-01-22 14:00:00.0",
            "eventProcessedDate": "2025-01-22 14:00:00.0",
            "periodId": 9889,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 1000
        }
    ],
    "errors": [],
    "warnings": []
}
{
    "pagination": {
        "limit": 1,
        "offset": 0,
        "total": 2
    },
    "data": [
        {
            "eventLogId": 31748158,
            "eventName": "GENERIC_EVENT",
            "customerId": 387544807,
            "eventDisplayName": "testBehavioural",
            "uniqueId": "6621dee9-6c2a-43ad-aa41-be2bf138de04",
            "eventDate": "2024-12-05 00:00:00.0",
            "eventProcessedDate": "2024-12-12 18:42:52.0",
            "periodId": 77865,
            "targetGroupId": 52065,
            "targetRuleId": 79192,
            "targetValue": 1.000
        }
    ],
    "errors": [],
    "warnings": []
}
{
    "pagination": {
        "limit": 30,
        "offset": 0,
        "total": 2
    },
    "data": [
        {
            "eventLogId": 615460983,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "881101809",
            "eventDate": "2025-01-22 14:00:00.0",
            "eventProcessedDate": "2025-01-22 14:00:00.0",
            "periodId": 9889,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 1000
        },
        {
            "eventLogId": 615461137,
            "eventName": "ADD_TRANSACTION",
            "customerId": 564332013,
            "eventDisplayName": null,
            "uniqueId": "881101873",
            "eventDate": "2025-01-22 14:00:00.0",
            "eventProcessedDate": "2025-01-22 14:00:00.0",
            "periodId": 9889,
            "targetGroupId": 1717,
            "targetRuleId": 1986,
            "targetValue": 1000
        }
    ],
    "errors": [],
    "warnings": []
}

Response parameters

ParameterDescription
paginationObject containing details of the page.
- limitNumber of events displayed on the page.
- offsetCurrent page number.
- totalTotal number of pages.
dataObject containing details of the events.
- eventLogIdUnique ID of the event that is triggered.
- eventNameName of the event. Possible values:
GENERIC_EVENT, ADD_TRANSACTION, RETURN_BILL, ENROL, UNENROL
- customerIdUnique ID of the customer who triggered the event.
- eventDisplayNameUnique name of the behavioural event that is triggered. The value is null for transactional events.
- uniqueIdUnique ID of the event.
For a behavioural event, the uniqueId is the requestId of the event.
For a non-behavioural event, the uniqueId is the eventSubjectId of the event.
- eventDateDate when the event is triggered in YYYY-MM-DD HH:MM:SS.s format.
- eventProcessedDateDate when the event is processed by the backend in YYYY-MM-DD HH:MM:SS.s format.
- periodIdUnique ID of the target period.
- targetGroupIdUnique ID of the target group associated with the target.
- targetRuleIdUnique ID of the target rule.
- targetValueTotal transaction amount for a transactional event. For behavioural event the value is always 1.000.
errorsObject containing errors, if any.
warningsObject containing warnings, if any.

API error codes

Error CodeDescriptionReason
310019Target period not foundperiodId is incorrect or invalid.
310018Target rule not foundruleId is incorrect or invalid.
310011Invalid userIduserId is incorrect or invalid.
310149No record found in user target for given UserId and TargetIdNo events are recorded for the user.
Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!