Tradenity Blog

Wed, Sep 21, 2016
  • developer
  • java
  • sdk
  • announcements

This post is now outdated, please view the updated one about the newly released major version 1.0.

We are happy to announce the general availability of the Tradenity Java SDK in version 0.8.0 release. The SDK Java API was carefully designed to make accessing the Tradenity REST API a seamless experience to java programmers. It was designed to provide object oriented interface hiding all the http request/response details of the REST API. Robustness and ease of use are key factors making You can download it from our Maven repository (more details below). The reference documentation is available here.

Prerequisites

To use the Tradenity SDK, you must have:

  • Working Java development environment (currently JDK 1.7 is the only tested version, but Java 6 abd 8 should work).
  • Active account in Tradenity

API Reference

The reference documentation is available here.

Installation

The SDK is available through our maven repository, You can install it using any compatible tool.


<repository>
    <id>tradenity-public</id>
    <name>tradenity-public-releases</name>
    <url>http://artifacts.tradenity.com/artifactory/tradenity-release-public</url>
</repository>

Maven


<dependency>
    <groupId>com.tradenity</groupId>
    <artifactId>java-sdk</artifactId>
    <version>0.8.0</version>
</dependency>

Gradle

compile com.tradenity:java-sdk:0.8.0

Ivy


<dependency org="com.tradenity" name="java-sdk" rev="0.8.0"/>

Setup your credentials

First of all, you have to get API keys for your store, you can find it in your store Edit page. To get there navigate to the stores list page, click on the Edit button next to your store name, scroll down till you find the API Keys section.

Initialize the library

With the API key in hand, you can initialize the Tradenity client. Tradenity client needs the API key and an instance of SessionTokenStore which is an object that makes Tradenity session integrates with the web framework’s session mechanism. The Java SDK provide the interface and a default implementation suitable for single user application (such as android app). The Spring SDK extension provide implementation suitable for Spring and Grails. It’s easy to implement your own for other frameworks, It is a simple 3 method interface.


TradenityClient client = new TradenityClient('sk_xxxxxxxxxxxxxxxxxxx')

Make sure to replace the api keys with the ones for your store, otherwise you will get authentication error

Make your First call

The Tradenity SDK is organized into a group of model entitiy classes that corresponds to the REST API’s resources, each encapsulate the operation for a specific entity model, for example to perform operations related to the Brand resource you can use the corresponding tradenity.sdk.entities.Brand class.

Now, just call any method in your code.


Brand brand = brandService.findById("1243-9786786-jhgjtu-789s6i");

Tutorials and sample applications

We provide 2 sample applications, actually it is the same application implemented using 2 frameworks: Spring MVC, and Grails.

Live demo

Camera store sample application live demo

Source code

You can find the code at github:

Camera store for spring mvc code.

Camera store for grails code.

Tutorials and guides

We also provide a detailed explanation of the code of these sample applications in the form of a step by step tutorials:

Camera store for spring mvc tutorial.

Camera store for grails tutorial.