webservices

ColdFusion Sample Documentation

by Administrator on ‎03-25-2011 09:33 AM

Getting Started with the Sample Upload Forms in ColdFusion

 

This page is intended to help users use the ColdFusion Contact Upload/Signup Form sample application.

 

1. Authentication Data

 

First, you must set up the username, password and API key to use this sample application to access the Constant Contact resources. The following features are available: add a new Contact (using the full or simplified form), search for a contact and then add or update it (both Contact adding or updating is performed using the full form), remove a Contact from all lists, and unsubscribing a Contact (opted=out Contacts become members of the "Do-Not-Mail" special list).

To set up the authentication data, you need to change the following variables in Application.cfc, which can be found on lines 12-14:

ccUsername: Constant Contact customer's username.
ccPassword: Constant Contact customer's password.
apiKey: API key used to identify the applications making an API request.

 

2. Customizing contact lists

 

There are some options for customization available in the sample in terms of which contact lists are used in the application. The default settings will show all available lists in the account, with the exception of the three special lists Active, Removed, and Do Not Mail. by modifying the 'doNotInclude' application variable, you can add lists that should not be returned throughout the application.

 

 

3. Create a New Contact

 

Users can create a  new Contact by filling out the full or simplified form. The full form allows users to provide the following information:  Email Address, First Name, Last Name, Middle Name, Home Phone, Address, City, State/Province, Zip/Postal Code, Sub Zip/Postal Code, Country, Company Name, Job Title, Work Phone, Email Format, Notes, Custom field 1 - 15 and Contact Lists on which the newly Contact would receive email. Multiple lists can be selected by holding down either [shift] or [ctrl]. Additional information can be added under the Work Details, Custom Fields & Notes and Contact Lists tabs.

 

Required fields are Email Address and at least one Contact List.

The simplified form allows users to provide: Email Address, First Name, Last Name, Middle Name, Home Phone, Address, City, State/Province, Zip/Postal Code, Sub Zip/Postal Code, Country and Contact Lists on which the newly Contact would receive email. Multiple lists can be selected by holding down either [shift] or [ctrl].

If the contact does not exist and is not a member of the Do Not Mail list, they will be added to the chosen lists.

4. Add or Edit a Contact

 

The Add or Edit a Contact section allows users to enter an email address and sign it up to their Constant Contact account. After clicking the Sign Up button, the email address is searched for in the account.

If the email address exists, the user is automatically redirected ot the page that allows them to update that Contact using the full form. Using this screen, you can now edit each field as well as modify the contact lists a user is subscribed to. Deselecting all lists will set the contact to 'Removed' status.

 

 

5. List all Contacts

 

The List Contacts option will display a ColdFusion grid of contacts contained within the account. Each page will display 50 contacts at a time, and will include a "Next" link if there is another page of contacts available. A contact may have their information edited by selecting the contact from the grid, selecting the 'Edit Contact' radio button, and clicking the submit button. By using the 'Remove Contact' radio button, the selected contact will be removed from all contact lists, and set to the 'Removed' status. Finally, by using the "Delete Contact" radio button, the selected contact will be removed from all contact lists, and be set to 'Do Not Mail' status.

 

6. Unsubscribe a contact

 

A contact can be unsubscribed by using the List all Contacts option, selecting the appropriate contact, followed by the 'Delete Contact' radio button, and pressing the submit button.

 

7. Remove a contact

 

A contact can be removed from all of their contact lists in 2 ways:
1) Using the List all Contacts option, users can remove a contact by selecting the appropriate contact, followed by the 'Remove Contact' radio button, and pressing the submit button.

 

2) Using the Add or Edit a contact option will all allow you to search for a contact by email address. If the email address exists, the user will be brought to the edit subscriber full form. By deselecting all available contact lists, the users status will be updated to 'Removed'. Please note: If you have modified the default value of the 'doNotInclude' variable on Application.cfc, this method may not update the contact's status to 'Removed' as not all lists may be shown in the form.

 

 

 

8. How To Use It

 

• Application.cfc - This component contains API Key, Username and Password used to access Constant Contact. Also contains http utility function used in all server calls, as well as other application variables.
• Contacts.cfc - This component contains all functions related to contact management.
• Lists.cfc - This component contains all functions related to contact management.
• /images - [DIR] - this directory contains all images used in the sample.
• add.cfm - This is the full contact form which contains all available Constant Contact fields.
• edit_full.cfm - This is the page designed to edit a contact profile. All available fields can be modified from this page.
• edit.cfm - Displays a search that will allow the user to edit the contact if they exist, or add them using add.cfm if they do not.
• header.cfm - File with basic design for a header, which contains an image as well as navigation menu included in all pages.
• import.cfm - Contains arrays holding information on available states and countries available for adding/editing a contact.
• list.cfm - ColdFusion grid displaying 50 contacts at a time, and provide a link to the next page of contacts if one is available.
• simple.cfm - Simple form which contains basic contact information. For a more robust form, add.cfm should be used.
• style.css - StyleSheet used in the sample application.