Skip to content

DataWorm/octoprint-java-lib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Octoprint Java Lib

Build Status

This is a very simple wrapper to provide Java based communication to an OctoPrint Server using the REST API

Please note that not all API functions are implemented here but most of them for doing common operations are ready to go. Pull Requests for additional functionality are welcome. Javadocs are published on GitHub Pages at https://robweber.github.io/octoprint-java-lib/

Required Libs

The json-simple library is required to encode/decode JSON objects. If you don't want to use maven here is a link: https://github.com/cliftonlabs/json-simple

SL4J is required for logging. https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.10

How to Use It

To use it simply create an OctoPrintInstance within your Java code and then use it to initate one of the Command classes.

OctoPrintInstance octoprint = new OctoPrintInstance("octoprint.local",80,"api_key");
PrinterCommand printer = new PrinterCommand(octoprint);

//get the current state
System.out.println(printer.getCurrentState());

if(printer.getCurrentState().isReady())
{
  //set the extruder temp - use the ToolCommand enum to get the command,the extruder num (0 indexed) and the value
  printer.sendExtruderCommand(ToolCommand.TARGET_TEMP,0,220);
}

About

A Java wrapper around the OctoPrint REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%