Events

Events are a unique entity that you can use to record various activities on the customer's account. The structure of events allows you to define different types of events with specific properties, group them, and link to an individual customer account. You can use events to trigger, manage, and create workflow conditions in the Marketing Automation application.

Scheme of the MA related resources and their relations

Available methods

All available methods for resource events.

HTTP method Endpoint Description
[badge-green POST] /events Create a new event
[badge-blue GET] /events Get information about all events
[badge-blue GET] /events/{event_id} Get information about a specific event

Available methods in sub-resources

All available sub-resources methods of the resource events.

HTTP method Endpoint Description
[badge-blue GET] /events/{event_id}/property-records Get a list of all property records of an event


Create a new event

Add a new event
[badge-green POST] /events

Request

Parameter name Type Description Mandatory (Yes/No)
event Event Event resource Yes
property_records PropertyRecord[] List of an event property records No

Response

Status code: 201 Created
Output structure : object

Parameter name Type Description
event_id string The unique id of the event

Example Request

POST https://<projectURL>/rest-api/enterprise-interface/v1.0/events
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmlzZV9pbnRlcmZhY2U6NTRlMDVkNzNTU0ODNjYzY3YjM1MTBkMGE4N2VhYWU1MDg4N2M1NTA2OWU0NDM5ZDEwOTEwMWM1ODNiOA==

{
  "event": {
    "event_type_id" : "8bed991c68a470e7aaeffbf048",
    "customer_id" : "85bc5819e09dab95437552ce79",
    "external_id" : "aaabbbccc"
  },
    "property_records": [
        {
            "property_id": "has_purchase",
            "property_value": "true"
        }
    ]
}

Example response

HTTP/1.1 201 Created
Date: Thu, 06 Aug 2020 11:30:31 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "event_id": "85c7c9d1ccf6c6dfed34edc8d2"
  }
}


Get information about all events

Get information about all events as a list
[badge-blue GET] /events

Query string

Parameter name Type Description Mandatory (Yes/No)
count integer The number of records to return.
Default value is 100.
No
offset integer The number of records from a collection to skip.
Default value is 0.
No
sort_field string One of the query string parameters for sorting.
Response is sorted by the specified field.
No
sort_direction string Direction of sorting the response list.
Possible values are: ASC / DESC
No
event_type_id string The unique id of the event type No

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
events Event[] Collection of all events
total_items integer Count of all found events

Example Request

GET https://<projectURL>/rest-api/enterprise-interface/v1.0/events?event_type_id=8bed991c68a470e7aaeffbf048&count=2
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmlzZV9pbnRlcmZhY2U6NTRlMDVkNzM30ODNjYzY3YjM1MTBkMGE4N2VhYWU1MDg4N2M1NTA2OWU0NDM5ZDEwOTEwMWM1ODNiOA==

Example response

HTTP/1.1 200 OK
Date: Thu, 06 Aug 2020 11:27:13 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "events": [
      {
        "event_id": "8bed991c68a470e7aaeffbf048",
        "event_type_id": "8bed991c68a470e7aaeffbf048",
        "customer_id": "85bc5819e09dab95437552ce79",
        "external_id": "157613",
        "data": "{\"test\":10,\"test2\":20}",
        "created_at": "2017-06-20 16:59:49",
        "secondary_external_id": null,
        "state": 1
      },
      {
        "event_id": "8bda8a4854394325e2748a5005",
        "event_type_id": "8bed991c68a470e7aaeffbf048",
        "customer_id": "85bc5819e09dab95437552ce79",
        "external_id": "3624",
        "data": "{\"test\":10,\"test2\":20}",
        "created_at": "2018-04-20 15:58:04",
        "secondary_external_id": null,
        "state": 1
      }
    ],
    "total_items": 114
  }
}


Get an event

Get information about a specific event
[badge-blue GET ]/events/{event_id}

Path parameters

Parameter name Type Description
event_id string The unique id for the event

Response

Status code: 200 OK
Output structure : Event

Example Request

GET https://<projectURL>/rest-api/enterprise-interface/v1.0/events/8bed991c68a470e7aaeffbf048
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmlzZV9pbnRlcmZhY2U6NTRlMDVkNzM3MTY3NTU0ODNjYzY3YjMMGE4N2VhYWU1MDg4N2M1NTA2OWU0NDM5ZDEwOTEwMWM1ODNiOA==

Example response

HTTP/1.1 200 OK
Date: Thu, 06 Aug 2020 11:27:48 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "event_id": "8bed991c68a470e7aaeffbf048",
    "event_type_id": "8bed991c68a470e7aaeffbf048",
    "customer_id": "85bc5819e09dab95437552ce79",
    "external_id": "157613",
    "data": "{\"test\":10,\"test2\":20}",
    "created_at": "2017-06-20 16:59:49",
    "secondary_external_id": null,
    "state": 1
  }
}