How to retrieve the status of bulk activity

There are two ways to gather the status on bulk activities:

  1. Make a GET call to /activities.
  2. Make a GET call to /activities/{activity_id}

When a request is made to one of the bulk activity endpoints, the response payload includes the activity_id assigned by the system. It also provides status information for the activity at that particular moment in time. Large requests, such as importing 10,000 contacts, take some time to process. You can check on status of the activity by making a GET call to the /activity/{activity_id} endpoint, using the activity_id returned in original response.

Activity Status Lifetime

An activity status is retained for 10 days.

Activity Status Collection

You can view all activity status from the last 10 days by making a GET call to the /activity endpoint.

Get Activities Request Sample

GET https://api.cc.email/v3/activities

<?php

$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/activities/');
$request->setMethod(HTTP_METH_GET);

$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/activities/ \
  -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/activities/")
  .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();

Get Activities Response Sample

{
  "activities": [
    {
      "activity_id": "{activity_id}",
      "state": "initialized",
      "started_at": "completed",
      "completed_at": "2016-01-23T13:48:44.108Z",
      "created_at": "2016-01-23T13:48:44.108Z",
      "updated_at": "2016-01-23T13:48:44.108Z",
      "source_file_name": "2016-21-04-contact_import.xls",
      "percent_done": 75,
      "activity_errors": [
        "Message describing the error condition."
      ],
      "status": {
        "items_total_count": 2200,
        "items_completed_count": 2100,
        "person_count": 8750,
        "error_count": 0,
        "correctable_count": 0,
        "cannot_add_to_list_count": 0,
        "list_count": 3
      },
      "_links": {
        "self": {
          "href": "/v3/activities/{activity_id}"
        }
      }
    }
  ],
  "_links": {
    "next": {
      "href": "/v3/activities/{actvity_id}"
    }
  }
}

Get Activity Request Sample

GET https://api.cc.email/v3/activities/{activity_id}

<?php

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

$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/activities/{activity_id} \
  -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/activities/{activity_id}")
  .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();

Get Activity Response Sample

{
  "activity_id": "04fe9a-a579-43c5-bb1a-58ed29bf0a6a",
  "state": "initialized",
  "started_at": "completed",
  "completed_at": "2016-01-23T13:48:44.108Z",
  "created_at": "2016-01-23T13:48:44.108Z",
  "updated_at": "2016-01-23T13:48:44.108Z",
  "source_file_name": "2016-21-04-contact_import.xls",
  "percent_done": 75,
  "activity_errors": [
    "Message describing the error condition."
  ],
  "status": {
    "items_total_count": 2200,
    "items_completed_count": 2100,
    "person_count": 8750,
    "error_count": 0,
    "correctable_count": 0,
    "cannot_add_to_list_count": 0,
    "list_count": 3
  },
  "_links": {
    "self": {
      "href": "/v3/activities/{actvity_id}"
    }
  }
}