Skip to content

lzpup/pardot-java-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pardot Java API Client

Build Status

What is it?

This library is a fluent style API client for Pardot's API (version 3 and 4).

Important Breaking Change to Pardot API

From February 1, 2021 Pardot is removing the ability to authenticate to the Pardot API using your Pardot username, password, and userkey (Salesforce EOL Notice). This means that versions of this library prior to 3.0.0 will cease to be able to authenticate to the Pardot Api.

Everyone is encouraged to update the library to version 3.0.0 or newer and switch to using Salesforce SSO authentication prior to February 1, 2021. To support Salesforce SSO authentication required backwards compatibility breaking changes to be made to this library, so please read the 2.x.x to 3.0.0 Migration Guide which details the changes required to upgrade.

Note While most of Pardot's API is supported by this library, if there is a feature/end point that you need that is not yet implemented, please read the How to Contribute section, or Create an issue requesting it.

Note Use this library at your own risk! Currently there are no known issues, but as an unofficial library, there are no guarantees.

How to use this library

This client library is released on Maven Central. Add a new dependency to your project's POM file:

<dependency>
    <groupId>com.darksci</groupId>
    <artifactId>pardot-api-client</artifactId>
    <version>3.1.0</version>
</dependency>

Example Code using Salesforce SSO Authentication:

/*
 * Create a new configuration object with your Salesforce SSO credentials.
 *
 * This configuration also allows you to define some optional details on your connection,
 * such as using an outbound proxy (authenticated or not).
 */
final ConfigurationBuilder configuration = Configuration.newBuilder()
    .withSsoLogin(
        "YourSalesforceUsername",
        "YourSalesforcePassword",
        "YourConnectedAppClientId",
        "YourConnectedAppClientSecret",
        "YourPardotBusinessUnitId"
    );

/*
 * Optionally you can explicitly select which API version to use. If none is explicitly selected
 * the library will default to version 3, but the library will automatically upgrade to version
 * 4 if required to do so.
 */
configuration.withApiVersion3();

/* Or */
configuration.withApiVersion4();

/*
 * Create an instance of PardotClient, passing your configuration.
 */
final PardotClient client = new PardotClient(configuration);

/*
 * The client will automatically authenticate when you make your first request, no need to
 * explicitly login.
 *
 * Lets create a simple Account request, and execute it.
 */
final AccountReadRequest accountReadRequest = new AccountReadRequest();
final Account account = client.accountRead(accountReadRequest);

/*
 * Or lets do a more complex Campaign search.
 */
final CampaignQueryRequest campaignQueryRequest = new CampaignQueryRequest()
    .withUpdatedAfter(DateParameter.last7Days())
    .withIdLessThan(1234L)
    .withSortById()
    .withSortOrderDescending();
final CampaignQueryResponse.Result campaignQueryResponse = client.campaignQuery(campaignQueryRequest);

/*
 * And when you're done, call close on PardotClient.
 */
client.close();

Or Using the Try-With-Resources Pattern:

/*
 * Since PardotClient implements Autoclosable, you can also use the try-with-resources pattern.
 */
try (final PardotClient client = new PardotClient(configuration)) {
    // Use client instance as needed
    client.accountRead(new AccountReadRequest());

    // client.close() is automatically called at the end of the try {} block.
}

What Features are implemented?

Authentication

Official Documentation: Authentication

  • Authenticating with Pardot's API using your Salesforce SSO Username, Password, and Connected Application details. See Example.
  • Legacy authentication using your Pardot Username, Password, and User Token. See Example.

Accounts

Official Documentation: Accounts

  • Read

Campaigns

Official Documentation: Campaigns

  • Create
  • Query
  • Read
  • Update

Custom Fields

Official Documentation: Custom Fields

  • Create
  • Query
  • Read
  • Update

Custom Redirects

Official Documentation: Custom Redirects

  • Query
  • Read

Dynamic Content

Official Documentation: Dynamic Content

  • Query
  • Read

Emails

Official Documentation: Emails

  • Read
  • Sending List Emails
  • Sending One to One Emails
  • Stats

Email Clicks

Official Documentation: Email Clicks

  • Query

Email Templates

Official Documentation: Email Templates

  • List One to One templates
  • Read

Forms

Official Documentation: Forms

  • Create
  • Delete
  • Query
  • Read
  • Update

Lists

Official Documentation: Lists

  • Create
  • Query
  • Read
  • Update

List Memberships

Official Documentation: ListMemberships

  • Create
  • Query
  • Read
  • Update

Opportunities

Official Documentation: Opportunities

  • Create
  • Delete
  • Query
  • Read
  • Undelete
  • Update

Prospects

Official Documentation: Prospects

  • Assign
  • Create - Does not support multiple values for record-multiple fields.
  • Delete
  • Query
  • Read
  • Unassign
  • Update - Does not support multiple values for record-multiple fields.
  • Upsert - Does not support multiple values for record-multiple fields.

Tags

Official Documentation: Tags

  • Query
  • Read

TagObjects

Official Documentation: TagObjects

  • Query
  • Read

Users

Official Documentation: Users

  • Abilities of current API User
  • Query
  • Read

Visitors

Official Documentation: Visitors

  • Assign
  • Query
  • Read

Visitor Activities

Official Documentation: VisitorActivities

  • Query
  • Read

How to Contribute

Want to help implement the missing API end points? Fork the repository, write some code, and submit a PR to the project!

Implementing new API requests really only requires implementing the two following interfaces, along with minimal glue code.

The Request interface can typically be implemented by extending either BaseRequest or BaseQueryRequest. This defines the end point that the request will hit, along with what parameters will be passed along with it.

The ResponseParser interface defines how to take the API's response and convert it back into user friendly Plain Old Java Objects (POJOs).

Contributors

Crim LoRez

Releasing

Steps for performing a release:

  1. Update release version: mvn versions:set -DnewVersion=X.Y.Z
  2. Validate and then commit version: mvn versions:commit
  3. Update CHANGELOG and README files.
  4. Merge to master.
  5. Deploy to Maven Central: mvn clean deploy -P release
  6. Create release on Github project, uploading JAR artifacts.

Changelog

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

View Changelog

About

A Java Client for the Pardot API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%