Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mcuadros/go-octoprint

Go library for accessing the OctoPrint's REST API
https://github.com/mcuadros/go-octoprint

3d-printing go golang octoprint rest-api

Last synced: about 2 months ago
JSON representation

Go library for accessing the OctoPrint's REST API

Awesome Lists containing this project

README

        

go-octoprint [![Build Status](https://travis-ci.org/mcuadros/go-octoprint.svg?branch=master)](https://travis-ci.org/mcuadros/go-octoprint) [![GoDoc](http://godoc.org/github.com/mcuadros/go-octoprint?status.svg)](http://godoc.org/github.com/mcuadros/go-octoprint)
==============================

Go library for accessing the [OctoPrint](http://octoprint.org/)'s [REST API](http://docs.octoprint.org/en/master/api/index.html).

Installation
------------

The recommended way to install go-octoprint

```
go get github.com/mcuadros/go-octoprint
```

Example
-------

### Retrieving the current connection state:

```go
client, _ := NewClient("", "")

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)
```

### Retrieving current temperature for bed and extruders:

```go
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)
}
```

## Implemented Methods

### [Version Information](http://docs.octoprint.org/en/master/api/version.html)
- [x] GET `/api/version`

### [Apps](http://docs.octoprint.org/en/master/api/apps.html)
- [ ] GET `/apps/auth`
- [ ] POST `/apps/auth`

### [Connection Operations](http://docs.octoprint.org/en/master/api/connection.html)
- [x] GET `/api/connection`
- [x] POST `/api/connection`

### [File Operations](http://docs.octoprint.org/en/master/api/files.html)
- [x] GET `/api/files
- [x] GET `/api/files/`
- [x] POST `/api/files/`
- [x] GET `/api/files//`
- [x] POST `/api/files//` (Only select command)
- [x] DELETE `/api/files//`

### [Job Operations](http://docs.octoprint.org/en/master/api/job.html)
- [x] POST `/api/job`
- [x] GET `/api/job`

### [Languages](http://docs.octoprint.org/en/master/api/languages.html)
- [ ] GET `/api/languages`
- [ ] POST `/api/languages`
- [ ] DELETE `/api/languages//`

### [Log file management](http://docs.octoprint.org/en/master/api/logs.html)
- [ ] GET `/api/logs`
- [ ] DELETE `/api/logs/`

### [Printer Operations](http://docs.octoprint.org/en/master/api/printer.html)
- [x] GET `/api/printer`
- [x] POST `/api/printer/printhead`
- [x] POST `/api/printer/tool`
- [x] GET `/api/printer/tool`
- [x] POST `/api/printer/bed`
- [x] GET `/api/printer/bed`
- [x] POST `/api/printer/sd`
- [x] GET `/api/printer/sd`
- [x] POST `/api/printer/command`
- [x] GET `/api/printer/command/custom` ([un-documented at REST API](https://github.com/foosel/OctoPrint/blob/7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc/src/octoprint/server/api/printer.py#L376))

### [Printer profile operations](http://docs.octoprint.org/en/master/api/printerprofiles.html)
- [ ] GET `/api/printerprofiles`
- [ ] POST `/api/printerprofiles`
- [ ] PATCH `/api/printerprofiles/`
- [ ] DELETE `/api/printerprofiles/`

### [Settings](http://docs.octoprint.org/en/master/api/settings.html)
- [x] GET `/api/settings`
- [ ] POST `/api/settings`
- [ ] POST `/api/settings/apikey`

### [Slicing](http://docs.octoprint.org/en/master/api/slicing.html)
- [ ] GET `/api/slicing`
- [ ] GET `/api/slicing//profiles`
- [ ] GET `/api/slicing//profiles/`
- [ ] PUT `/api/slicing//profiles/`
- [ ] DELETE `/api/slicing//profiles/`

### [System](http://docs.octoprint.org/en/master/api/system.html)
- [x] GET `/api/system/commands`
- [ ] GET `/api/system/commands/`
- [x] POST `/api/system/commands//`

### [Timelapse](http://docs.octoprint.org/en/master/api/timelapse.html)
- [ ] GET `/api/timelapse`
- [ ] DELETE `/api/timelapse/`
- [ ] POST `/api/timelapse/unrendered/`
- [ ] DELETE `/api/timelapse/unrendered/`
- [ ] POST `/api/timelapse`

### [User](http://docs.octoprint.org/en/master/api/users.html)
- [ ] GET `/api/users`
- [ ] GET `/api/users/`
- [ ] POST `/api/users`
- [ ] PUT `/api/users/`
- [ ] DELETE `/api/users/`
- [ ] PUT `/api/users//password`
- [ ] GET `/api/users//settings`
- [ ] PATCH `/api/users//settings`
- [ ] POST `/api/users//apikey`
- [ ] DELETE `/api/users//apikey`

### [Util](http://docs.octoprint.org/en/master/api/util.html)
- [ ] POST `/api/util/test`

### [Wizard](http://docs.octoprint.org/en/master/api/wizard.html)
- [ ] GET `/setup/wizard`
- [ ] POST `/setup/wizard`

License
-------

MIT, see [LICENSE](LICENSE)