Skip to content

Falkplan/lightspeedecom-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lightspeedecom-api

Java api client for the lightspeed ecommerce platform, based on http://developers.lightspeedhq.com/ecom/

install

[Release] (https://jitpack.io/#falkplan/lightspeedecom-api)

Add jitpack.io repository: https://jitpack.io/

Add dependency to maven:

dependency>
    <groupId>com.github.Falkplan</groupId>
    <artifactId>lightspeedecom-api</artifactId>
    <version>v1.0.0</version>
</dependency>

or gradle:

dependencies {
  compile 'com.github.Falkplan:lightspeedecom-api:v1.0.0'
}

Usage

LightspeedEComClient lightspeedEComClient = LightspeedEComClient.builder()
                .cluster("api.webshopapp.com")
                .language("nl")
                .authorisation("yourapikey", "yourapisecret")
                .build();

The client supports the following methods:

Error handling

LightspeedEComErrorException (RunTimeException) can be thrown at any call when the api returns an error status, the error description will be contained in the .error object inside the exception.

Know that your api key has a rate limit that will throw an error when it exceeds the limit.

There is an option to use the "force" method in the builder to retry a request when the limit was exceeded, this will block the tread though!

There is also an option to set a request limit ("limit" in builder) to only use a certain amount of requests, to preserve the rate limit for other usages.

Testing

To run the tests rename default.test.properties to test.properties and set all values.

To acquire authentication see: http://developers.lightspeedhq.com/ecom/introduction/authentication/ and see http://developers.lightspeedhq.com/ecom/introduction/clusters/ for cluster.

Warning: Tests are not setup for users of this library, but they could be edited for universal usage.


Notice: Falkplan is not to be associated with Lightspeed, Falkplan is merely a customer of Lightspeed.