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
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 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 export the Email Address, First Name and Last Name of three contacts (Fred Test, Joan Test and Ann Test) from a list in the joesflowers account.
|activityType||EXPORT_CONTACTS||The type of activity to create.|
|listId||URI||The list the data is exported from. The
|fileType||CSV (NOTE: Support for TXT fileType ends as of 11/14/2014)||Format of the export file|
|exportOptDate||true, false||true to include the Add/Remove Date in the export file, false to not include it|
|exportOptSource||true, false||true to include the Added/Removed By (source of add or remove) in the export file, false to not include it|
|true (deprecated as of 01/09/2015)
||true to include the List Name in the export file,
|sortBy||EMAIL_ADDRESS, DATE_DESC||EMAIL_ADDRESS to sort the list by email address in ascending order. DATE_DESC will sort the contacts by the Date in descending order|
|columns||EMAIL ADDRESS, FIRST NAME, MIDDLE NAME, LAST NAME, JOB TITLE, COMPANY NAME, WORK PHONE, HOME PHONE, ADDRESS LINE 1, ADDRESS LINE 2, ADDRESS LINE 3, CITY, STATE, STATE/PROVINCE (US/CANADA), COUNTRY, POSTAL CODE, SUB POSTAL CODE, CUSTOM FIELD 1, CUSTOM FIELD 2, CUSTOM FIELD 3, CUSTOM FIELD 4, CUSTOM FIELD 5, CUSTOM FIELD 6, CUSTOM FIELD 7, CUSTOM FIELD 8, CUSTOM FIELD 9, CUSTOM FIELD 10, CUSTOM FIELD 11, CUSTOM FIELD 12, CUSTOM FIELD 13, CUSTOM FIELD 14, CUSTOM FIELD 15||URL encoded, multi-valued list of which optional fields to include in the exported file. The names are the same as those used in files for upload. See the support FAQ for details. Note that the field names include spaces, which must be properly encoded in the request.|
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.
After the system has finished processing the Export activity, retrieving the activity entry will return a complete entry that includes the status of the job. If the job completed successfully, it will also contain a link to the exported file. See the example below:
<link href="/ws/customers/joesflowers/activities/a07e1gpfcd3fhysynnp" rel="edit" />
<title type="text">EXPORT_CONTACTS: http://api.constantcontact.com/ws/customers/joesflowers/activities/a07e1...
<Activity xmlns="http://ws.constantcontact.com/ns/1.0/" id="http://api.constantcontact.com/ws/customers/joesflowers/activities/a07e1gpfcd3fhysynnp">
<link href="http://api.constantcontact.com/ws/customers/joesflowers/activities/a07e1gpfcd3fhysynnp.csv" rel="edit-media" />
<title type="text">Activity Collection for customer: joesflowers</title>
<link href="" />
<link href="" rel="self" />