Skip to content

99Taxis/zendesk-java-api

Repository files navigation

zendesk-java-api

Build Status Codacy Badge Coverage Status Dependencies Dependency Status Join the chat at https://gitter.im/99taxis/zendesk-java-api

Zendesk Java API is a simple client library for Java that provides an interface to the Zendesk Core API.

Note: zendesk-java-api is a partial implementation of the Zendesk Core API. The Zendesk Core API and the Zendesk Java API are both under development, and this library is subject to frequent change.

License GitHub tag Maintenance

Supported Methods

Most of the tickets and search APIs, and some of the users and ticket_fields APIs.

Download

Zendesk Java API is not yet listed on Maven Central nor any real maven repository, but we use our raw Github public maven repo. So, to use it, add the repository to your pom.xml file:

<repository>
  <id>99taxis-github-maven-repo</id>
  <url>https://raw.github.com/99taxis/maven-public/master/releases</url>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
</repository>

and the zendesk-java-api lib

<dependency>
  <groupId>com.taxis99</groupId>
  <artifactId>zendesk-java-api</artifactId>
  <version>LATEST_VERSION</version>
</dependency>

zendesk-java-api supports Java 8.

Usage

First, set the credentials in a properties file (see zendesk-sample.properties), set some environment variables, or extend ZendeskConfig yourself and bind the config and a default Gson instance.

import com.google.gson.Gson;
import com.taxis99.zendesk.config.GsonInstanceHolder;
import com.taxis99.zendesk.config.ZendeskConfig;
import com.taxis99.zendesk.config.ZendeskConfigFromEnvironment;
import com.taxis99.zendesk.config.ZendeskConfigFromProperties;

...

  final Gson gson;
  final ZendeskConfig config;

  gson = GsonInstanceHolder.getDefaultBuilder().setPrettyPrinting().create();
  if (ZendeskApiTest.class.getResource("/zendesk.properties") != null) {
    config = new ZendeskConfigFromProperties();
  } else {
    config = new ZendeskConfigFromEnvironment();
  }

After that you instantiate a ZendeskApi object.

import com.taxis99.zendesk.ZendeskApi;

...

  final ZendeskApi zendeskApi = new ZendeskApi(gson, config);

You can then use Zendesk API methods:

import com.taxis99.zendesk.ZendeskApi;
import com.taxis99.zendesk.model.Ticket;

...

  final Ticket ticket = zendeskApi.getTicketById(46239L);

License

zendesk-java-api is open source software released under the MIT License.

See the LICENSE file for details.