Skip to content

1337joe/inventree-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InvenTree SDK (Java)

A Java InvenTree (GitHub) API client.

javadoc

Usage

Add Dependency

This library is published to Maven Central, so if you're using Maven simply include in your dependency pom like so:

<dependency>
    <groupId>com.w3asel</groupId>
    <artifactId>inventree-sdk-java</artifactId>
    <version>0.17.294.1</version>
</dependency>

Alternately, if you're just looking for a jar file you can find it attached to the corresponding release here on GitHub.

The version number is a mix of the InvenTree release (0.17) and the schema version (294) with point releases after that when multiple client jars are released against the same schema.

The main branch of this repository tracks InvenTree/master and may not be compatible with the latest stable release. As it is not tied to an InvenTree release, it is published as -SNAPSHOT jars (browsable here), which may be consumed by adding the central snapshot repository to your pom:

<repositories>
  <repository>
    <name>Central Portal Snapshots</name>
    <id>central-portal-snapshots</id>
    <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    <releases>
      <enabled>false</enabled>
    </releases>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

Calling a server

See the tests for examples of various calls to a InvenTree. Specifically, start here for a simple, self-contained file that connects to a server and retrieves Sales Orders: TestClient.java

Javadocs are hosted here if you want to browse the available calls.

Running a Local InvenTree Server

Set up an InvenTree dev environment.

invoke dev.setup-test
invoke dev.server

Be sure to run invoke update when pulling updates into your dev environment.

Generate Schema from InvenTree

You can either browse to http://localhost:8000/api-doc/ (or the corresponding path on your instance, browsable from the About InvenTree dialog), or from a dev environment run:

invoke dev.schema --filename api.yaml --overwrite

If you just want to pull a pre-built copy of a specific version of the schema you can browse the InvenTree schema repo.