tradenity-java-sdk

Java SDK for Tradenity E-commerce REST API, simple object oriented api that encapsulate Tradenity API resources in a java programmer friendly fashion.

License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.tradenity
ArtifactId

ArtifactId

java-sdk
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

tradenity-java-sdk
Java SDK for Tradenity E-commerce REST API, simple object oriented api that encapsulate Tradenity API resources in a java programmer friendly fashion.
Project URL

Project URL

https://github.com/tradenity/java-sdk
Source Code Management

Source Code Management

https://github.com/tradenity/java-sdk/tree/master

Download java-sdk

How to add to project

<!-- https://jarcasting.com/artifacts/com.tradenity/java-sdk/ -->
<dependency>
    <groupId>com.tradenity</groupId>
    <artifactId>java-sdk</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.tradenity/java-sdk/
implementation 'com.tradenity:java-sdk:1.0.2'
// https://jarcasting.com/artifacts/com.tradenity/java-sdk/
implementation ("com.tradenity:java-sdk:1.0.2")
'com.tradenity:java-sdk:jar:1.0.2'
<dependency org="com.tradenity" name="java-sdk" rev="1.0.2">
  <artifact name="java-sdk" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tradenity', module='java-sdk', version='1.0.2')
)
libraryDependencies += "com.tradenity" % "java-sdk" % "1.0.2"
[com.tradenity/java-sdk "1.0.2"]

Dependencies

compile (4)

Group / Artifact Type Version
com.squareup.retrofit2 : retrofit jar 2.5.0
com.squareup.retrofit2 : converter-gson jar 2.5.0
com.squareup.okhttp3 : okhttp jar 3.12.1
com.google.code.gson : gson jar 2.8.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Welcome to the Tradenity Java SDK

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 and 8 should work).
  • Active account in Tradenity

Installation

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

Maven

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

Gradle

Add this line to the dependency section

compile com.tradenity:java-sdk:1.0.2

Ivy

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

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), and it's easy to implement your own for other frameworks, It is a simple 3 method interface. If you are using Spring framework or Grails, the Spring SDK extension provide implementation suitable for Spring and Grails.

TradenityClient client = new TradenityClient('sk_1234567')

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.

BrandService brandService = new BrandService(client);
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 of Camerastore, check it out to have an idea of what Tradenity API can do.

You can find the code at Github:

Camera store for spring mvc code.

Camera store for grails code.

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.

Versions

Version
1.0.2
1.0.1
1.0.0