Go library for accessing the OctoPrint's REST API.
The recommended way to install go-octoprint
go get github.com/mcuadros/go-octoprint
client, _ := NewClient("<octoprint-url>", "<api-key>")
r := octoprint.ConnectionRequest{}
s, err := r.Do(client)
if err != nil {
log.Error("error requesting connection state: %s", err)
}
fmt.Printf("Connection State: %q\n", s.Current.State)r := octoprint.StateRequest{}
s, err := r.Do(c)
if err != nil {
log.Error("error requesting state: %s", err)
}
fmt.Println("Current Temperatures:")
for tool, state := range s.Temperature.Current {
fmt.Printf("- %s: %.1f°C / %.1f°C\n", tool, state.Actual, state.Target)
}- GET
/api/version
- GET
/apps/auth - POST
/apps/auth
- GET
/api/connection - POST
/api/connection
- GET `/api/files
- GET
/api/files/<location> - POST
/api/files/<location> - GET
/api/files/<location>/<filename> - POST
/api/files/<location>/<path>(Only select command) - DELETE
/api/files/<location>/<path>
- POST
/api/job - GET
/api/job
- GET
/api/languages - POST
/api/languages - DELETE
/api/languages/<locale>/<pack>
- GET
/api/logs - DELETE
/api/logs/<filename>
- GET
/api/printer - POST
/api/printer/printhead - POST
/api/printer/tool - GET
/api/printer/tool - POST
/api/printer/bed - GET
/api/printer/bed - POST
/api/printer/sd - GET
/api/printer/sd - POST
/api/printer/command - GET
/api/printer/command/custom(un-documented at REST API)
- GET
/api/printerprofiles - POST
/api/printerprofiles - PATCH
/api/printerprofiles/<profile> - DELETE
/api/printerprofiles/<profile>
- GET
/api/settings - POST
/api/settings - POST
/api/settings/apikey
- GET
/api/slicing - GET
/api/slicing/<slicer>/profiles - GET
/api/slicing/<slicer>/profiles/<key> - PUT
/api/slicing/<slicer>/profiles/<key> - DELETE
/api/slicing/<slicer>/profiles/<key>
- GET
/api/system/commands - GET
/api/system/commands/<source> - POST
/api/system/commands/<source>/<action>
- GET
/api/timelapse - DELETE
/api/timelapse/<filename> - POST
/api/timelapse/unrendered/<name> - DELETE
/api/timelapse/unrendered/<name> - POST
/api/timelapse
- GET
/api/users - GET
/api/users/<username> - POST
/api/users - PUT
/api/users/<username> - DELETE
/api/users/<username> - PUT
/api/users/<username>/password - GET
/api/users/<username>/settings - PATCH
/api/users/<username>/settings - POST
/api/users/<username>/apikey - DELETE
/api/users/<username>/apikey
- POST
/api/util/test
- GET
/setup/wizard - POST
/setup/wizard
MIT, see LICENSE