We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

scribe-java OAuth API now supports Constant Contact!!


scribe-java OAuth API now supports Constant Contact!!

Greetings, Constant Contact developers!




For those of you who are Java programmers, I am pleased to announce that scribe-java, the most-used open source Java OAuth library, now has support for Constant Contact. I had written the original implementation and worked with the owner of the project on github to include my changes, which he has recently done. If you are interested, login to your github account (you do have a github account, don't you? :smileywink:) and check out the project at: https://github.com/fernandezpablo85/scribe-java.






With scribe-java, obtaining OAuth access tokens and making REST calls to obtain protected resources is very straight-forward. For example, let's say you wanted to search for a contact by email address. If you already have an access token, you can do this in a few lines of code:






// Create the service 



OAuthService _service = new

// Assuming userName and email are string variables with appropriate values
String serviceURI = "https://api.constantcontact.com/ws/customers/" + userName + "/contacts?email=" + email;
OAuthRequest getContactRequest = new OAuthRequest(Verb.GET, serviceURI);
_service.signRequest(_accessToken, getContactRequest);
Response getContactResponse = getContactRequest.send();
String contactEntry = getContactResponse.getBody();
That's it. The contactEntry now has the XML for the contact and you're ready to parse it. If you're still doing OAuth Java by hand, stop it now! Download scribe-java with its new support for Constant Contact and save yourself some time and headaches. And stay tuned for more sample code designed to help you with common coding tasks using Java and Constant Contact.


Happy Coding!

Matthew D. Laudato
Product Manager, Integrations, APIs and Web Services
Constant Contact, Inc.



































Developer Portal

View API documentation, code samples, get your API key.

Visit Page