The Report Contact Events command allows you to get the Contact Data and Tracking Events for a Contact specified by the Customer Key in Realms where the option is enabled.
GET /subscribers/[customerKey]/events?querystring
https://[siteurl]/rest/subcribers/[customerKey]/events?querystring
The following queries are supported:
start=[yyyy-mm-dd]
end=[yyyy-mm-dd]
eventType=[eventType]
Event types include all events defined in the Name column of Tracking Event Type definition table.
Request Body Parameters
The Report Contact Events command requires the URI call with the Customer Key and Events parameter. Optional Filters include Start and End Date parameters and Event Type. No additional fields are required in the JSON.
The query strings 'start', 'end', and 'eventType' are case sensitive and must be defined as in the example above. The Date fields support the date format yyyy-mm-dd. If the query string is incorrect or missing, it is ignored and the command returns all Events for the Contact.
The query assumes the time of midnight of the date defined. For instance, to get only Contacts with an event on June 15th, 2016, set the dates to the following:
start=2016-06-15
end=2016-06-16
To include events that occurred on the 16th also, set the end date to one day greater than 16, June 17th.
Request Body Example
Using Report Contact Events:
curl --request GET \
--url 'https://mail.mydomain.com/rest/subscribers/ck10/events?start=2016-06-01&end=2016-06-30' \
--header 'authorization: Basic bXlBY2NvdW50Onh5enB3ZDEyMw==' \
--header 'accept: application/vnd.whatcounts-v1+json' \
--header 'content-type: application/json' \
--include
Response Body
The response returns Contact data in JSON format for the Contact and all events that match any of the query fields.
If more than 500 results are found, the first 500 are displayed, and you must use the "skip" value to view the next 500.
For example, to find the three groups of 500 Contacts in a List with 1455 matching Contacts, the URIs would be formatted as:
- https://[siteurl]/rest/subscribers/[customerKey]/events?start=2016-06-01&end=2016-06-30&skip=0
- https://[siteurl]/rest/subscribers/[customerKey]/events?start=2016-06-01&end=2016-06-30&skip=500
- https://[siteurl]/rest/subscribers/[customerKey]/events?start=2016-06-01&end=2016-06-30&skip=1000
For more information about "skip", see Pagination.
Based on the example above, and four Events for the contact, the response returns:
HTTP/1.1 200 OK
Server: serverName
Content-Type: application/json
Link: <https://mail.mydomain.com/rest/subscribers/ck10/events?start=2016-06-15&end=2016-06-16>;
Date: Fri, 17 Jun 2016 12:54:44 GMT
{
"subscriberId": 10
"realmId": 1561
"email": "jon.doe@mydomain.com"
"firstName": "Jon"
"lastName": "Doe"
"company": "My Company"
"address1": "123 Some Street North"
"address2": "Suite 500"
"city": "My City"
"state": "WA"
"zip": "98000"
"country": "United States"
"phone": "(206) 555 1212"
"fax": ""
"createdDate": "May 21, 2012 9:14:16 AM"
"updatedDate": "Nov 2, 2015 10:31:27 AM"
"customerKey": "ck10"
"ipAddress": ""
"md5Encryption": "C8ADED17D5F088E8262BF31ED933B7D4"
"sha1Encryption": "356B1860247728C81486A35062688F302D96C2D1"
"events":
{
"trackingId": 5134504
"trackingCampaignId": 11714
"trackingEventDate": "Jun 15, 2016 10:26:48 PMM"
"trackingRealmId": 1014
"trackingListId": 10
"trackingSubscriberId": 10
"trackingEventType": 9
"eventType": "SENDMESSAGE"
"trackingClickthroughId": 0
"trackingMetaData": ""
"skip": 3
"max": 0
}
{
"trackingId": 5066229
"trackingCampaignId": 11714
"trackingEventDate": "Jun 15, 2016 10:26:48 PM"
"trackingRealmId": 1014
"trackingListId": 10
"trackingSubscriberId": 10
"trackingEventType": 40
"eventType": "DISPLAY_MSG"
"trackingClickthroughId": 0
"trackingMetaData": ""
"skip": 2
"max": 0
}
{
"trackingId": 5066219
"trackingCampaignId": 11714
"trackingEventDate": "Jun 15, 2016 10:34:47 PM"
"trackingRealmId": 1014
"trackingListId": 10
"trackingSubscriberId": 10
"trackingEventType": 11
"eventType": "CLICKTHROUGH"
"trackingClickthroughId": 44210
"trackingMetaData": ""
"skip": 1
"max": 0
}
{
"trackingId": 5066223
"trackingCampaignId": 11714
"trackingEventDate": "Jun 15, 2016 10:34:33 PM"
"trackingRealmId": 1014
"trackingListId": 10
"trackingSubscriberId": 10
"trackingEventType": 10
"eventType": "READ"
"trackingClickthroughId": 0
"trackingMetaData": ""
"skip": 0
"max": 0
}
"customData": {
"text": "text"
"unicode": "unicode text"
"large": "big"
"number": 12
"float": 12.12
"date": "2016-07-04"
},
"skip": 1
"max": 0
}
Error Response
Error Response Codes include both Client Errors (4xx) and Server Errors (5xx). Descriptions of each can be found in Response Codes.
For example, if the Authorization is incorrect, the error would appear as:
{
"error": "Unauthorized"
"status": "Unauthorized"
"statusCode": 401
}