Pardot Java API version 4 Client
What is it?
This library intends to be a fluent style API client for Pardot's API (version 4).
Note It currently is not fully featured/fully implemented. 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>net.jakubpas</groupId>
<artifactId>pardot-api-client</artifactId>
<version>0.1.6</version>
</dependency>
Example Code:
/*
* Create a new configuration object with your Pardot credentials.
*
* This configuration also allows you to define some optional details on your connection,
* such as using an outbound proxy (authenticated or not).
*/
final Configuration configuration = new Configuration("YourPardotUserNameHere", "PardotPassword", "UserKey");
/*
* 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.
*/
final Configuration configuration = new Configuration("YourPardotUserNameHere", "PardotPassword", "UserKey");
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 Pardot Username, Password, and User Token.
Accounts
Official Documentation: Accounts
- Read
Campaigns
Official Documentation: Campaigns
- Create
- Query
- Read
- Update
Emails
Official Documentation: Emails
- Read
- Sending List Emails
- Sending One to One Emails
- Stats
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.
Users
Official Documentation: Users
- Abilities of current API User
- 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.
Request
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.
ResponseParser
The ResponseParser interface defines how to take the API's response and convert it back into user friendly Plain Old Java Objects (POJOs).
Changelog
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.