How to retrieve open and click rates

Use the /reports/contact_reports/{contact_id}/open_and_click_rates endpoint to retrieve open and click rates for a specific contact.

The endpoint requires two query parameters, start and end, that define a date range for the report. The start and end query parameters must be provided in ISO 8601 format, e.g. 2018-08-16 or 2018-08-16T12:30:00Z. The date range cannot exceed five years from start to end.

Example GET Request

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

Endpoint Requirements

User privileges: ui:campaign:metrics

Authorization scopes: contact_data

<?php

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

$request->setQueryData(array(
  'start' => '2018-01-01T00:00:00.000Z',
  'end' => '2018-08-09T00:00:00.000Z'
));

$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}/open_and_click_rates?start=2018-01-01T00:00:00.000Z&end=2018-08-09T00:00:00.000Z' \
  -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}/open_and_click_rates?start=2018-01-01T00:00:00.000Z&end=2018-08-09T00:00:00.000Z")
  .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

{
  "contact_id": "71600990-908b-11e6-907f-00166bff25",
  "included_activities_count": 10,
  "average_open_rate": 0.6,
  "average_click_rate": 0.6
}

Try it!