How to retrieve activity details

Use the /reports/contact_reports/{contact_id}/activity_details endpoint to retrieve a list of all activities that have occurred on all email campaigns for a specific contact.

Use the tracking_activities_list query parameter to specify a list of activity types to report on. Activity types include:

  • em_sends
  • em_opens
  • em_clicks
  • em_bounces
  • em_optouts
  • em_forwards

If the tracking_activities_list query parameter is not included in the url, it will default to em_clicks. Use the limit query parameter to specify the number of activities to return in a single page. Valid values are 1 to 100. If the limit query parameter is not included in the url, it will default to 100.

Example GET Request

GET https://api.cc.email/v3/reports/contact_reports/{contact_id}/activity_details

Endpoint Requirements

Authorization scopes: contact_data

The code examples below demonstrate how to pass a list of activity types in the tracking_activities_list query parameter as well as how to use the limit query parameter.

<?php

$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/reports/contact_reports/{contact_id}/activity_details');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData(array(
  'tracking_activities_list' => 'em_sends,em_clicks',
  'limit' => '25'
));

$request->setHeaders(array(
  'Accept' => 'application/json',
  'Content-Type' => 'application/json',
  'Authorization' => 'Bearer {access_token}',
  'Cache-Control' => 'no-cache'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
curl -X GET \
  'https://api.cc.email/v3/reports/contact_reports/{contact_id}/activity_details?tracking_activities_list=em_sends,em_clicks&limit=25' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {access_token}' \
  -H 'Cache-Control: no-cache'
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("https://api.cc.email/v3/reports/contact_reports/{contact_id}/activity_details?tracking_activities_list=em_sends,em_clicks&limit=25")
  .get()
  .addHeader("Accept", "application/json")
  .addHeader("Content-Type", "application/json")
  .addHeader("Authorization", "Bearer {access_token}")
  .addHeader("Cache-Control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

Example GET Response

{
  "tracking_activities": [
    {
      "contact_id": "71600990-908b-11e6-907f-00166bff25",
      "campaign_activity_id": "010a0-1234-5678-9012-1100a0c1ab2a",
      "created_time": "2017-04-02T04:08:00.000Z",
      "tracking_activities_list": "em_sends"
    },
    {
      "contact_id": "71600990-908b-11e6-907f-00166bff25",
      "campaign_activity_id": "010a0-1234-5678-9012-1100a0c1ab2a",
      "created_time": "2017-04-02T05:11:34.000Z",
      "tracking_activities_list": "em_clicks"
    }
  ],
  "_links": {
    "next": {
      "href": "string"
    }
  }
}

Try it!