In order to use the Constant Contact SDK you have to follow these steps:
- Add the constantcontact-2.0.jar library to classpath of your project.
Also add this libraries to classpath of project: jackson-annotations-2.1.1.jar jackson-core-2.1.1.jar jackson-databind-2.1.3.jar constant-contact-httpclient-4.2.3.jar
- Place your credentials in app.config file.
APIKey=APIkey
ConsumerSecret=ConsumerSecret
Password=password
Username=username
RedirectURL=RedirectURL
- In the file you wish to use the SDK include the following code in your file:
import com.constantcontact.*;
import com.constantcontact.components.contacts.*;
import com.constantcontact.services.*;
import com.constantcontact.authentication.*;
import com.constantcontact.util.*;
- Create a ConstantContact object
In order to use credentials defined in app.config file you can use this constructor:
ConstantContact constantContact = new ConstantContact();
Otherwise the credentials can be specified as constructor parameters
ConstantContact constantContact = new ConstantContact("username", "password", "apiKey", "redirectUrl");
- Use the functions of the SDK using the created object.
######Example for getting an contact
Contact contact = constantContact.getContact(int contactId);
######Example for getting contact list
ResultSet<Contact> contactList = constantContact.getContacts();
4)Usage in Android
In order to use the Constant Contact SDK for Android you have to include constant contact SDK sources and libraries.