Helps interacting with the OPCRM API, providing you quick and easy access to API resources in useful formats.
Clone or download
Latest commit d38953b Aug 23, 2018

OnePageCRM Java API Wrapper

This project is a comprehensive java API wrapper aimed to abstract some of the difficulties associated with getting started interacting with external APIs, providing you quick and easy access to API resources in useful formats.

The project uses Gradle, an advanced, general purpose build management system. This allows for streamlined functionality, such as automatically including jars in the build path or running unit tests much more efficiently.

What can it do?

This project communicates using the OnePageCRM API. It can, for example, log in users, obtain details about their account, and perform a range of actions such as adding calls and creating contacts.

List available gradle commands:

./gradlew tasks

Run all unit tests:

./gradlew test

Create jar file for use in projects:

./gradlew jar

Getting started

  • Clone the repository.

  • Import the project into your IDE.

  • Create a file containing your OnePageCRM username and password.


The following is an example of a method which will:

  • Log in a user.
  • Display details about the user and their account.
  • Get their Action Stream.
  • Get their a-to-z list of Contacts.
  • Get their list of Deals.
  • Pick the first Contact.
  • And add a new Call for that Contact.
  • Create a new Contact.
  public static void main(String[] args) {

    // Login 
    User loggedInUser = User.login("username", "password");

    // Display all the details about the user / account."Logged in User : " + loggedInUser);"User's Team : " + loggedInUser.getAccount().team);"User's Settings : " + Account.settings);"User's Statuses : " + loggedInUser.getAccount().statuses);"User's Lead Sources : " + loggedInUser.getAccount().leadSources);"User's Custom Fields : " + loggedInUser.getAccount().customFields);"User's Company Fields : " + loggedInUser.getAccount().companyFields);"User's Call Results : " + loggedInUser.getAccount().callResults);"User's Filters : " + loggedInUser.getAccount().filters);"User's ContactsCounts : " + loggedInUser.getAccount().contactsCount);"User's StreamCount : " + loggedInUser.getAccount().streamCount);"User's Predefined Actions : " + loggedInUser.getAccount().predefinedActions);"User's Contact Titles : " + loggedInUser.getAccount().contactTitles);"User's Account Rights : " + loggedInUser.getAccountRights());

    // Get user's Action Stream
    ContactList stream = loggedInUser.actionStream();

    // Get user's list of contacts in alphabetical order
    ContactList contacts = loggedInUser.contacts();

    // Get user's list of deals (pipeline)
    DealList pipeline = loggedInUser.pipeline();

    // Pick the first contact from the Action Stream
    Contact contact = stream.get(0);

    if (contact.isValid()) {

      // Get the list of Actions associated with that contact
      List<Action> actions = contact.getActions();

      // Get the Next Action specifically
      Action nextAction = contact.getNextAction();

      // Create a new Call resource
      Call newCall = new Call()
            .setCallResult(new CallResult()
            .setText("From Java Wrapper..."));

      Contact newContact = new Contact()
            .setCompanyName("Myles Inc.")


The following is an example of a method which will:

  • Log in a user.
  • Pick their first contact.
  • Add a new deal for that contact.
    public static void main(String[] args) throws OnePageException {

        User loggedInUser = User.login("username", "password");

        //Pick the first contact from the Action Stream
        Contact first = loggedInUser.actionStream().get(0);

        //Create a new deal
        new Deal()
             .setText("Java Wrapper Deal Text")
             .setName("Java Wrapper Deal Name")