A new Activity is created by making an HTTP POST to the activity
collection URI. In contrast to the Contact List, the Activity POST body
is not an Atom Entry. Instead it is several named parameters encoded
with one of the HTML FORM content types, either application/x-www-form-urlencoded
or multipart/form-data
. So the data passed in the POST body is the same as that produced by a FORM with the ENCTYPE attribute set to that type.
The "Clear Contacts" function works like the "Remove" function, except that you don't have to provide a list of email addresses that you wish to remove. Select the lists you wish to clear carefully. If you clear contacts from all lists, you will not have any contacts left in your Constant Contact account.
You should refrain from additional operations on the list you are clearing until the job is complete. For example, adding contacts to the list before the clear contacts activity is complete may result in those new contacts being cleared when the activity is run.
application/x-www-form-urlencoded
Request
The basics of how to construct an application/x-www-form-urlencoded
request are simple:
Most programming languages have libraries that implement some or all
of the encoding process. The parameters and their values are described
in the table below. More details on how to make an application/x-www-form-urlencoded
request are in the HTML specification.
The following example shows the parameters used to clear two contact lists, identified by ID's 2 and 5. Note that two contact lists are submitted in a single invocation of the Activities resource.
activityType=CLEAR_CONTACTS_FROM_LISTS
&lists=http%3A%2F%2Fapi.constantcontact.com%2Fws%2Fcustomers%2Fjoesflowers%2Flists%2F2
&lists=http%3A%2F%2Fapi.constantcontact.com%2Fws%2Fcustomers%2Fjoesflowers%2Flists%2F5
application/x-www-form-urlencoded
Parameters
Name | Allowed values | Description |
---|---|---|
activityType | CLEAR_CONTACTS_FROM_LISTS | The type of activity to create. When clearing subscribers from the list, they will not be deleted, only removed from the list(s) specified. NOTE: "Named" lists cannot be cleared. These incldude "Do-Not-Mail", "Removed", "Awaiting Confirmation", "All" and "Active". If an attempt to clear one of these lists (or another non-existant list) is made, the request will fail with a "400 Bad Request" |
lists | URI (one or more) | The list to clear The list should be a list id URI as referenced in the Contact Lists Collection. |
multipart/form-data
Request
When using FORMs, you must use enctype="multipart/form-data"
when using <input type="file">
. Similarly, when uploading a complete file of data, particularly binary data like MS Excel spreadsheets, you must use a multipart/form-data
request. Most programming languages have libraries that implement some
or all of the encoding process. The parameters and their values are
described in the table below.. More details on how to make an multipart/form-data
request are in the HTML specification and RFC 2388.
multipart/form-data
Parameters
Name | Allowed values | Description |
---|---|---|
activityType | CLEAR_CONTACTS_FROM_LISTS | The type of activity to create. When clearing subscribers from the list, they will not be deleted, only removed from the list(s) specified. NOTE: "Named" lists cannot be cleared. These incldude "Do-Not-Mail", "Removed", "Awaiting Confirmation", "All" and "Active". If an attempt to clear one of these lists (or another non-existant list) is made, the request will fail with a "400 Bad Request" |
lists | URI (one or more) | The list to clear. The list should be a list id URI as referenced in the Contacts List Collection. |
If the new activity is created successfully, the server will return an HTTP status of 201 Created
.
The HTTP Location header in the response will contain the URI of the
newly created activity, and the entity body returned will be the minimal
entry
for the activity, including server-generated values like ids and links:
<entry xmlns="http://www.w3.org/2005/Atom">
<link href="/ws/customers/joesflowers/activities/a07e1ffaxjyffmvqgiz" rel="edit" />
<id>http://api.constantcontact.com/ws/customers/joesflowers/activities/a07e1ffaxjyffmvqgiz</id>
<title type="text"></title>
<updated>2008-04-29T19:35:54.923Z</updated>
</entry>