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.
Constructing an application/x-www-form-urlencoded Request
The basics of how to construct an application/x-www-form-urlencoded request are simple:
Parameter names and values are escaped. Space characters are replaced by `+', and then reserved characters are escaped as described in [RFC1738], section 2.2: Non-alphanumeric characters are replaced by `%HH', a percent sign and two hexadecimal digits representing the ASCII code of the character. Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A').
The parameter name is separated from the value by `=' and name/value pairs are separated from each other by `&'.
To use paramter values that contain delimiter characters, such as a comma, you need to enclose the value in double quotes, then encode the value. For example, to use a parameter value of 'Boston, MA', you need to use '%22Boston%2C%20MA%22'.
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.
The list the data is exported from. The list should be a list id URI as referenced in the Contact Lists Collection. System defined lists, such as 'do-not-mail' are supported.
CSV (NOTE: Support for TXT fileType ends as of 11/14/2014)
Format of the export file
true to include the Add/Remove Date in the export file, false to not include it
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), false
true to include the List Name in the export file, false to not include it
EMAIL_ADDRESS to sort the list by email address in ascending order. DATE_DESC will sort the contacts by the Date in descending order
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: