The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

scribe-java OAuth API now supports Constant Contact!!

Highlighted
Administrator

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
ServiceBuilder()
.provider(ConstantContactApi.class)
.apiKey(apiKey)
.apiSecret(apiSecret)
.build();
 

// 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

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured