Giter Club home page Giter Club logo

java-sdk's Introduction

Constant Contact Java SDK Build Status Download

Java and Android library for accessing the Constant Contact API. Based on the Retrofit framework.

Usage

You'll need an API key and access token to use the SDK. Do so by creating a developer account here, then register an app to generate an API key and access token for an account.

Then, start by creating the CCApi2 object, and make the call you need through the appropriate service. Learn more about signing up for a developer account here.

All of the calls respond with Retrofit Call objects, which can be consumed synchronously (execute) or asynchronously (enqueue). Full documentation of the Call class can be found here.

Each service is fully documented in the Javadoc with full explanations of each parameter.

Get Account Information (Synchronous Example)

CCApi2 api = new CCApi2("your_api_key", "your_access_token");
try {
    AccountSummaryInformation accountSummary = api.getAccountService()
                                                  .getAccountSummaryInformation()
                                                  .execute()
                                                  .body();
} catch (IOException e) {
    // Handle exception
}

Get Contact Collection (Asynchronous Example)

CCApi2 api = new CCApi2("your_api_key", "your_access_token");
Callback<Paged<Contact>> callback = new Callback<Paged<Contact>>() {
    @Override
    public void onResponse(Response<Paged<Contact>> response) {
        List<Contact> contacts = response.body().getResults();
    }
    
    @Override
    public void onFailure(Throwable t) {
    }
}
api.getContactService().getContacts(50, ContactStatus.ACTIVE).enqueue(callback);

Installation

The JAR is available on JCenter, or you can download manually from the releases page. Note, if you download manually, you will also need to download the Components JAR and include it in your build file.

Artifacts

The base library is the java-sdk artifact. If you use RxJava there are two artifacts available depending on the version: java-sdk-rx for RxJava 1 users and java-sdk-rx2 for RxJava 2 users (all calls return Observable).

Gradle - Release

compile 'com.constantcontact:java-sdk:5.2.2'

Gradle - Snapshot

allprojects {
    repositories {
        maven("https://oss.jfrog.org/artifactory/oss-snapshot-local/")
    }
}
compile 'com.constantcontact:java-sdk:X.X.X-SNAPSHOT'

Maven

<dependencies>
    <dependency>
        <groupId>com.constantcontact</groupId>
        <artifactId>java-sdk</artifactId>
        <version>5.2.2</version>
    </dependency>
</dependencies>

Release Process

There's an automated build process set up for the various build types that can occur, based on where code is pushed or merged.

  1. When a PR is opened, or pushed to, Travis CI will run a PR build which then reports the status back to the GitHub PR. If any unit tests fail, the PR will not be mergable until they are fixed.
  2. When a PR is merged to master, or if there's a push to master, Travis CI will run a regular build with test, and then automatically deploy a SNAPSHOT build to https://oss.jfrog.org (a.k.a. OJO). These builds can be found here.
  3. When a tag is applied to a commit that follows the format '#.#.#', Travis CI will run a release build, and then upload to the Bintray maven repo (which also automatically deploys to JCenter), as well as creates a draft release here.
    1. In order for the Bintray release to become visible, the uploads must be made public. The Bintray maven dashboard page will have a node that there are 16 or so unreleased files with a publish link. Click publish to release it.
    2. Likewise, the GitHub release is generated as a draft. Edit the draft, add notes about the changes and click publish to make it visible to developers.

License

Copyright (c) 2016, Constant Contact, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted 
provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions 
and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of 
conditions and the following disclaimer in the documentation and/or other materials provided 
with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to 
endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

java-sdk's People

Contributors

acase1094 avatar aguriuc avatar alexandrurosu29 avatar cristiana-rotar avatar csciuto avatar dsjellz avatar egaiter avatar funmark avatar ggrell avatar harshithagb avatar richm541 avatar thegravee avatar woogienoogie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-sdk's Issues

Delete email campaign?

Noticed that there is no ability to delete an email campaign in this API? Is this going to be added?

getDetailedStatusReport not working

Hi all
I try to get the DetailedStatusReport for activity to poll the activity status until it is completed.
I am using getDetailedStatusReport and getting errors from constantContact.

RawApiRequestError [errorKey=query.param.invalid, errorMessage=The query parameter id is not supported.]
RawApiRequestError [errorKey=url, errorMessage=https://api.constantcontact.com/v2/activities?type=ADD_CONTACTS&id=9420c040-fdc0-11e4-9f58-d4ae527548e1]

Look like the id parameter should be in the url path and not in query args

By the way do addContacts command check for the status of the activity before returning the Result or should i handle it myself?
Thanks!
Yuval Perelman

Updating a contact with a pre-existing "note" results in error

I am updating a contact w/ a pre-existing "note" (not set by the api).

I am not manipulating the note just updating another field on the contact.

No matter what I do I get back

"json.field.note.too.many: Only one note is allowed"

The only way around it is to do this "contactToSave.setNotes(null);"

There is no way to even append data to an existing note!

"Created_date" not supported for ContactLists

JSON parsing for contact list objects no longer works as the JSON string contains a "Created_date" which is not implemented in ContactList.Java.

Either the fields needs to be added to the Pojo, or (as we did) change the parser policy to ignore unkown properties.

We changed Component.java and added to the listFromJson method following line : mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Ronny.

ArchiveURL, Archivestatus still in SDK

A developer brought up the issue in this community post:
https://community.constantcontact.com/t5/Developer-Support-ask-questions/ArchiveURL-missing-from-Campaign-details-in-API-v2/m-p/229439#M9145

They always return null, but it's raising questions with developers, causing confusion, hesitation.

We have by design removed support for email campaign archive_url and archive_status in AppConnect, but the functions still exist.

https://github.com/constantcontact/java-sdk/blob/master/src/main/java/com/constantcontact/components/emailcampaigns/EmailCampaignBase.java

https://github.com/constantcontact/java-sdk/blob/master/src/main/java/com/constantcontact/components/emailcampaigns/EmailCampaignRequest.java

Paginated API calls should be available through the services directly.

As an example, the getContacts method in IContactService (https://github.com/constantcontact/java-sdk/blob/master/src/main/java/com/constantcontact/services/contacts/IContactService.java) does not support pagination. It returns an object (ResultSet), that contains an object (Meta), that contains the Pagination object inside of it. This object must then be passed to the PaginationHelperService (https://github.com/constantcontact/java-sdk/blob/master/src/main/java/com/constantcontact/pagination/PaginationHelperService.java) to get the next page. We should have overloaded versions of the methods that take the Pagination object like the .NET version does. An example can be seen here: https://github.com/constantcontact/.net-sdk/blob/master/CTCTWrapper/Services/ContactService.cs

Cannot close inputstream after call bulkContactUploadMultipart

Hi,

I have been having a few issues with using the api for uploading xls files. Basically, we have a large number of repetitive eMails going out and I have built an app that streamlines the uploading of the lists.

I note that addBulkContactsMultipart opens a fileinputstream, which is then used in MutipartBuilder.buildMultipartBody, but it is not closed meaning the file remains locked after the method has returned. Shouldn't the filestream be closed after the filestream has been consumed?

Cheers,

James

ServiceException message gets swallowed

There are places in the code where we are throwing a ServiceException and then catching it and wrapping it in a ServiceException. For example, the Bulk Import API. This is a problem because the constructor loses the exception's message, making it very difficult to figure out what went wrong. We should either fix the Constructor or not catch the exception.

Publish artifacts to maven repository

Is there a reason there aren't any artifacts published to a central Maven repository? Makes it somewhat cumbersome to get up and running with the Java SDK.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.