Compare commits

..
689 changed files with 26686 additions and 159104 deletions

No files matched your search

-22
View File
@@ -1,22 +0,0 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
[**.py]
indent_style = tab
indent_size = 4
[src/octoprint/static/js/app/**.js]
indent_style = space
indent_size = 4
[.travis.yml]
indent_style = space
indent_size = 2
-9
View File
@@ -1,10 +1 @@
src/octoprint/_version.py export-subst
src/octoprint/static/js/lib/* linguist-vendored
src/octoprint/static/less/bootstrap/* linguist-vendored
src/octoprint/static/less/font-awesome.less linguist-vendored
src/octoprint/static/less/mixins.less linguist-vendored
src/octoprint/static/less/variables.less linguist-vendored
versioneer.py linguist-vendored
docs/* linguist-documentation
-5
View File
@@ -1,5 +0,0 @@
# These are supported funding model platforms
github: [foosel]
patreon: foosel
custom: https://octoprint.org/support-octoprint/
-135
View File
@@ -1,135 +0,0 @@
---
name: Bug report
about: Create a report to help improve OctoPrint
---
<!--
READ THE FOLLOWING FIRST:
If not already done, please read the the Contribution Guidelines that
are linked to the right under "Helpful resources" > "Contributing".
Also read the FAQ: https://faq.octoprint.org
This is a bug and feature tracker, please only use it to report bugs
or request features within OctoPrint (not OctoPi, not any OctoPrint
plugins and not unofficial OctoPrint versions).
Do not seek support here ("I need help with ...", "I have a
question ..."), that belongs on the community forum at
community.octoprint.org, NOT here.
Mark requests with a "[Request]" prefix in the title please. For bug
reports fully fill out the bug reporting template (if you don't know
where to find some information - it's all described in the Contribution
Guidelines linked up there in the big yellow box).
When reporting a bug do NOT delete ANY lines from the template.
Make sure any bug you want to report is still present with the CURRENT
OctoPrint version and that it does not vanish when you start OctoPrint
in safe mode - how to do that is also explained in the Contribution
Guidelines linked up there in the big yellow box.
Thank you!
-->
#### What were you doing?
<!--
Please be as specific as possible here. The maintainers will need to
reproduce your issue in order to fix it and that is not possible if they
don't know what you did to get it to happen in the first place.
Ideally provide exact steps to follow in order to reproduce your problem:
-->
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
<!--
If you encountered a problem with specific files of any sorts, make sure
to also include a link to a file with which to reproduce the problem.
-->
#### What did you expect to happen?
#### What happened instead?
#### Did the same happen when running OctoPrint in safe mode?
<!--
Test if you can reproduce your problem in safe mode. You can find information
on how to enable safe mode in the Contribution Guidelines.
If you can't reproduce in safe mode, this is a bug with one of your
installed third party plugins. Don't open a ticket here!
If you can't test this in safe mode, state why.
-->
#### Version of OctoPrint
<!--
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
-->
#### Operating System running OctoPrint
<!--
OctoPi, Linux, Windows, MacOS, something else? With version please.
OctoPi's version can be found in /etc/octopi_version or in the lower left
corner of the web interface.
-->
#### Printer model & used firmware incl. version
<!--
If applicable, always include if unsure.
-->
#### Browser and version of browser, operating system running browser
<!--
If applicable, always include if unsure.
-->
#### Link to octoprint.log
<!--
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
The Contribution Guidelines tell you where to find that.
-->
#### Link to contents of terminal tab or serial.log
<!--
On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting communication issues. Never truncate.
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log (which the Contribution Guidelines tell you where to find).
-->
#### Link to contents of Javascript console in the browser
<!--
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.
The Contribution Guidelines tell you where to find that.
-->
#### Screenshot(s)/video(s) showing the problem:
<!--
If applicable. Always include if unsure or reporting UI issues.
-->
I have read the FAQ.
-21
View File
@@ -1,21 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
---
<!--
Please make sure to add [Request] to your issue's title. Thank you!
-->
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
-54
View File
@@ -1,54 +0,0 @@
<!--
Thank you for your interest into contributing to OctoPrint, it's
highly appreciated!
Please make sure you have read the "guidelines for contributing" as
linked just above this form, there's a section on Pull Requests in there
as well that contains important information.
As a summary, please make sure you have ticked all points on this
checklist:
-->
* [ ] Your changes are not possible to do through a plugin and relevant
to a large audience (ideally all users of OctoPrint)
* [ ] If your changes are large or otherwise disruptive: You have
made sure your changes don't interfere with current development by
talking it through with the maintainers, e.g. through a
Brainstorming ticket
* [ ] Your PR targets OctoPrint's devel branch if it's a completely
new feature, or maintenance if it's a bug fix or improvement of
existing functionality for the current stable version (no PRs
against master or anything else please)
* [ ] Your PR was opened from a custom branch on your repository
(no PRs from your version of master, maintenance or devel please),
e.g. dev/my_new_feature or fix/my_bugfix
* [ ] Your PR only contains relevant changes: no unrelated files,
no dead code, ideally only one commit - rebase and squash your PR
if necessary!
* [ ] Your changes follow the existing coding style
* [ ] If your changes include style sheets: You have modified the
.less source files, not the .css files (those are generated with
lessc)
* [ ] You have tested your changes (please state how!) - ideally you
have added unit tests
* [ ] You have run the existing unit tests against your changes and
nothing broke
* [ ] You have added yourself to the AUTHORS.md file :)
<!--
Describe your PR further using the template provided below. The more
details the better!
-->
#### What does this PR do and why is it necessary?
#### How was it tested? How can it be tested by the reviewer?
#### Any background context you want to provide?
#### What are the relevant tickets if any?
#### Screenshots (if appropriate)
#### Further notes
-15
View File
@@ -1,10 +1,3 @@
src/octoprint/templates/_data/AUTHORS.md
src/octoprint/templates/_data/CHANGELOG.md
src/octoprint/templates/_data/SUPPORTERS.md
src/octoprint/templates/_data/THIRDPARTYLICENSES.md
devtools
*.tar.bz2
*.tar.gz
*.7z
@@ -29,11 +22,3 @@ OctoPrint.egg-info
*.orig
*.codekit
venv
venv26
venv27
venv33
venv34
venv35
venv36
+3 -6
View File
@@ -2,11 +2,8 @@
language: python
python:
- "2.7"
- "2.7"
install:
- pip install -e .[develop]
- pip install -r requirements.txt
script:
- nosetests --with-doctest
sudo: false
git:
depth: 250
- nosetests
+2 -2
View File
@@ -2,7 +2,7 @@
host = https://www.transifex.com
[octoprint.messages]
file_filter = translations/<lang>/LC_MESSAGES/messages.po
source_file = translations/messages.pot
file_filter = src/octoprint/translations/<lang>/LC_MESSAGES/messages.po
source_file = src/octoprint/translations/messages.pot
source_lang = en
+6 -21
View File
@@ -7,27 +7,12 @@
# The file is processed from top to bottom, the first matching line wins. If <tag> or <reference commit> are left out,
# the lookup table does not apply to the matched branches
# master, meta, rc and prerelease shall not use the lookup table, only tags
# master and staging shall not use the lookup table
master
meta/.*
rc/.*
hotfix/.*
prerelease
staging
# neither should disconnected checkouts, e.g. 'git checkout <tag>'
HEAD
\(detached.*
# fix/ branches are fixes for master, so we don't handle those either
fix/.*
# maintenance is currently the branch for preparation of maintenance release 1.3.12
# so are any fix/... and improve/... branches
maintenance 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
fix/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
improve/.* 1.3.12 73df8c2407f04756261acfe62ac3d72877f8a97d pep440-dev
# staging/maintenance is currently the branch for preparation of 1.3.11rc4
# so is regressionfix/...
staging/maintenance 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev
regressionfix/.* 1.3.11rc4 af3285854995fb5b910fd2ce869e26c02d57bbc2 pep440-dev
# every other branch is a development branch and thus gets resolved to 1.4.0-dev for now
.* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev
# every other branch is a development branch and thus gets resolved to 1.2.0-dev for now
.* 1.2.0-dev 50cf776e70b9
-115
View File
@@ -1,115 +0,0 @@
# Authors
The following people have contributed to OctoPrint's code base (ordered roughly by
date of first contribution):
* [Gina Häußge](https://github.com/foosel)
* [Thomas Sanladerer](https://github.com/imitation)
* [Alex Ustyantsev](https://github.com/hudbrog)
* [Andrew Dalgleish](https://github.com/ajd4096)
* [Dale Price](https://github.com/daprice)
* [Václav "ax" Hůla](https://github.com/AxTheB)
* [Tom Perry](https://github.com/daftscience)
* [Andreas Gohr](https://github.com/splitbrain)
* [Lars Norpchen](https://github.com/norpchen)
* [Marlon Wünnemann](https://github.com/marwue)
* ["algspd"](https://github.com/algspd)
* [Peter Uithoven](https://github.com/peteruithoven)
* [Bryan Mayland](https://github.com/CapnBry)
* [Ross Hendrickson](https://github.com/savorywatt)
* [Dan Lipsitt](https://github.com/DanLipsitt)
* [James Gao](https://github.com/jamesgao)
* [Tonnerre Lombard](https://github.com/tonnerre)
* [Marc Hannappel](https://github.com/Salandora)
* [Brad Pitcher](https://github.com/brad)
* [Gabe Rosenhouse](https://github.com/rosenhouse)
* [chriskoz](https://github.com/chriskoz)
* [Ilya Novoselov](https://github.com/nullie)
* [Corey C](https://github.com/C-o-r-E)
* [Jarek Szczepanski](https://github.com/imrahil)
* [Jon Nordby](https://github.com/jonnor)
* [Aaron Bieber](https://github.com/qbit)
* [Guy Sheffer](https://github.com/guysoft)
* [Dattas Moonchaser](https://github.com/dattas)
* [Pim Rutgers](https://github.com/Booli)
* [Koen Kooi](https://github.com/koenkooi)
* [Colin Wallace](https://github.com/Wallacoloo)
* [Michael Ang](https://github.com/mangtronix)
* [Philipp Engel](https://github.com/nosyjoe)
* [Giles Hall](https://github.com/vishnubob)
* [Bevaz](https://github.com/Bevaz)
* [Bortek](https://github.com/bortek)
* [Rob Speed](https://github.com/rspeed)
* [Renha](https://github.com/Renha)
* [Antoine Bertin](https://github.com/Diaoul)
* [Teja Philipp](https://github.com/hungerpirat)
* ["matobago"](https://github.com/matobago)
* ["nophead"](https://github.com/nophead)
* [Bob Clough](https://github.com/thinkl33t)
* [Mikk Kiilaspää](https://github.com/Mikk36)
* [Jack Minardi](https://github.com/jminardi)
* [Mark Walker](https://github.com/markwal)
* [Lucas Clemente](https://github.com/lucas-clemente)
* [Andrew Erickson](https://github.com/aerickson)
* [Nicanor Romero Venier](https://github.com/nicanor-romero)
* [Thomas Hou](https://github.com/masterhou)
* [Mark Bastiaans](https://github.com/markbastiaans)
* [Marcel Hellwig](https://github.com/punkkeks)
* [Kevin Murphy](https://github.com/kevingelion)
* [Richard Joyce](https://github.com/richjoyce)
* ["bwgan"](https://github.com/bwgan)
* [Siim Raud](https://github.com/2ndalpha)
* ["geoporalis"](https://github.com/geoporalis)
* [Andrew Malota](https://github.com/2bitoperations)
* [Ishwar Agarwal](https://github.com/agarwali)
* [Kye Hoover](https://github.com/eykrevooh)
* [Joseph Carrick](https://github.com/carricktel)
* [Alexander Leisentritt](https://github.com/Alex9779)
* [therealbstern](https://github.com/therealbstern)
* [Philipp Baum](https://github.com/philphilphil)
* [Kyle Evans](https://github.com/kevans91)
* [Javier Martínez Arrieta](https://github.com/Javierma)
* ["MirceaDan"](https://github.com/ByReaL)
* [Ovidiu Hossu](https://github.com/MoonshineSG)
* [Eyck Jentzsch](https://github.com/eyck)
* [Mathias Rangel Wulff](https://github.com/mathiasrw)
* [Clemens Niemeyer](https://github.com/clemniem)
* ["I-am-me"](https://github.com/I-am-me)
* [Noah Martin](https://github.com/noahsmartin)
* [Eyal Soha](https://github.com/eyal0)
* [Greg Hulands](https://github.com/ghulands)
* [Andreas Werner](https://github.com/gallore)
* [Shawn Bruce](https://github.com/kantlivelong)
* [Claudiu Ceia](https://github.com/ClaudiuCeia)
* [Goswin von Brederlow](https://github.com/mrvn)
* [Luke McKechnie](https://github.com/galamdring)
* [Peter Backx](https://github.com/pbackx)
* [Josh Major](https://github.com/astateofblank)
* ["alex-gh"](https://github.com/alex-gh)
* [Bernd Zeimetz](https://github.com/bzed)
* [Daniele Forsi](https://github.com/dforsi)
* [Ganey](https://github.com/ganey)
* [Sven Lohrmann](https://github.com/malnvenshorn)
* [Andy Castille](https://github.com/klikini)
* [Gaston Dombiak](https://github.com/gdombiak)
* [Brad Fisher](https://github.com/bradcfisher)
* [Aldo Hoeben](https://github.com/fieldofview)
* [Henning Groß](https://github.com/hgross)
* [Jubaleth](https://github.com/jubaleth)
* [Daniel Joyce](https://github.com/DanielJoyce)
* [Andy Qua](https://github.com/AndyQ)
* [Fabio Santos](https://github.com/Fabi0San)
* [Jack Wilsdon](https://github.com/jackwilsdon)
* [Ryan Finnie](https://github.com/rfinnie)
* [Timur Duehr](https://github.com/tduehr)
* [Nicolai Nielsen](https://github.com/dovecode)
* [Janne Mäntyharju](https://github.com/JanneMantyharju)
* [Steven Spungin](https://github.com/flamenco)
* [Piotr Usewicz](https://github.com/pusewicz)
* [Aliaksei Pilko](https://github.com/aliaksei135)
* [Ben Yarmis](https://github.com/byarmis)
OctoPrint started off as a fork of [Cura](https://github.com/daid/Cura) by
[Daid Braam](https://github.com/daid). Parts of its communication layer and
the server side GCODE interpreter are still based on Cura's code base from
December 2012 and hence on the work of its authors up until then.
+143 -1237
View File
File diff suppressed because it is too large. Load diff
+16 -484
View File
@@ -1,490 +1,22 @@
# Contribution Guidelines
Issues, Tickets, however you may call them
------------------------------------------
This document outlines what you need to know before **[creating tickets](#issues-tickets-however-you-may-call-them)**
or **[creating pull requests](#pull-requests)**.
Read the following short instructions **fully** and **follow them** if you want your ticket to be taken care of and not closed again directly!
## Contents
- Always create **one ticket for one purpose**. So don't mix two or more feature requests, support requests, bugs etc into one ticket. If you do, your ticket will be treated as if only describing the first purpose, the others will be ignored!
- If you want to report a bug, **READ AND FOLLOW [How to file a bug report](https://github.com/foosel/OctoPrint/wiki/How-to-file-a-bug-report)!** Tickets will be automatically checked if they comply with the requirements outlined in that wiki node! Other then what's written in there (**and really EVERYTHING that is written in there!**) you don't have to do anything special with your ticket.
- If you want to post a **request** of any kind (feature request, documentation request, ...), **add [Request] to your issue's title!**
- If you need **support** with a problem of your installation (e.g. if you have problems getting the webcam to work), **add [Support] to your issue's title!**. Note that for problems like these, the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741) will probably get you help faster!
- If you have a general **question**, **add [Question] to your issue's title!**. Note that for problems like these, the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741) will probably get you help faster!
- If you have another reason for creating a ticket that doesn't fit any of the above categories, think hard if it might not be something better suited for the [Mailinglist](https://groups.google.com/group/octoprint) or the [Google+ Community](https://plus.google.com/communities/102771308349328485741). If you are sure it needs to be reported here, **add [Misc] to your issue's title!**
* [Issues, Tickets, however you may call them](#issues-tickets-however-you-may-call-them)
* [How to file a bug report](#how-to-file-a-bug-report)
* [What should I do before submitting a bug report?](#what-should-i-do-before-submitting-a-bug-report)
* [What should I include in a bug report?](#what-should-i-include-in-a-bug-report)
* [Where can I find which version and branch I'm on?](#where-can-i-find-which-version-and-branch-im-on)
* [Where can I find those log files you keep talking about?](#where-can-i-find-those-log-files-you-keep-talking-about)
* [Where can I find my browser's error console?](#where-can-i-find-my-browsers-error-console)
* [Setting up a development environment](#setting-up-a-development-environment)
* [Pull requests](#pull-requests)
* [What do the branches mean?](#what-do-the-branches-mean)
* [How OctoPrint is versioned](#how-octoprint-is-versioned)
* [History](#history)
* [Footnotes](#footnotes)
Following these guidelines (**especially EVERYTHING mentioned in ["How to file a bug report"](https://github.com/foosel/OctoPrint/wiki/How-to-file-a-bug-report)**) is necessary so the tickets stay manageable - you are not the only one with an open issue, so please respect that you have to **play by the rules** so that your problem can be taken care of. Tickets not playing by the rules **will be closed without further investigation!**.
## Issues, Tickets, however you may call them
Pull Requests
-------------
Please read the following instructions fully and follow them. You can
help the project tremendously this way: not only do you help the maintainers
to **address problems in a timely manner** but also keep it possible for them
to **fix bugs, add new and improve on existing functionality** instead of doing
nothing but ticket management.
1. Please create all pull requests against the `devel` branch.
2. Create **one pull request per feature/bug fix**.
3. Create a custom branch for your feature/bug fix and use that as base for your pull request. Pull requests directly against your version of `devel` will be closed.
4. In your pull request's description, state what your pull request is doing, as in, what feature does it implement, what bug does it fix.
![Ticket flow chart](https://i.imgur.com/cw19qHX.png)
- **[Read the FAQ](https://faq.octoprint.org)**
- If you want to report a **bug**, [read "How to file a bug report" below](#how-to-file-a-bug-report)
and *[use the provided template](#what-should-i-include-in-a-ticket)*.
You do not need to do anything else with your ticket.
- If you want to post a **feature request** or a **documentation request**, add `[Request]`
to your issue's title (e.g. `[Request] Awesome new feature`). A question on how to run/change/setup
something is **not** what qualifies as a request here, use the
[community forum at community.octoprint.org](https://community.octoprint.org) for
such support issues.
- If you are a **developer** that wants to brainstorm a pull request or possible
changes to the plugin system, please get in touch on the
[community forum at community.octoprint.org](https://community.octoprint.org/c/development).
- If you need **support**, have a **question** or some **other reason** that
doesn't fit any of the above categories, the issue tracker is not the right place.
Consult the [community forum at community.octoprint.org](https://community.octoprint.org/c/support) instead.
No matter what kind of ticket you create, never mix two or more "ticket reasons"
into one ticket: One ticket per bug, request, brainstorming thread please.
> 👉 **Note**
>
> A bot is in place that monitors new tickets, automatically
> categorizes them and checks new bug reports for usage of the provided template.
> That bot will only bother you if you open a ticket that appears to be a bug (no
> `[Request]` in the title) without the complete template, and it
> will do that only to ensure that all information needed to solve the issue is
> available for the maintainers to directly start tackling that problem.
## How to file a bug report
If you encounter an issue with OctoPrint, you are welcome to
[submit a bug report](https://github.com/foosel/OctoPrint/issues/new).
Before you do that for the first time though please take a moment to read the
following section *completely* and also follow the instructions in the
"new issue" form. Thank you! :)
### What should I do before submitting a bug report?
1. **Make sure you are at the right location**. This is the bug tracker
of the official version of OctoPrint, which is the 3D print server and
corresponding web interface itself.
**OctoPrint doesn't manage your network connection or your webcam nor
can it fix your printer not getting detected as a serial interface** -
if you have any kinds of problems with that, get in touch on the
[community forum](https://community.octoprint.org).
**This is not the bug tracker of OctoPi**, which is the preconfigured
Raspberry Pi image including OctoPrint among other things - that one can be found
[here](https://github.com/guysoft/OctoPi). If you have any kind of specific
issue with how the OctoPi system is setup, go there please.
**This is also not the bug tracker of any OctoPrint Plugins you
might have installed**. Report any issues with those in their corresponding
bug tracker (probably linked to from the plugin's homepage).
Finally, **this is also not the right bug tracker if you are running a
forked version of OctoPrint**. Seek help for such unofficial versions from
the people maintaining them instead.
2. Please make sure to **test out the current version** of OctoPrint to see
whether the problem you are encountering still exists, and **test without
any third-party plugins enabled** to make sure it's not a misbehaving
plugin causing the issue at hand. For that please restart OctoPrint in
**safe mode**, either by selecting "Restart OctoPrint in safe mode" from
the "System" menu, or by starting OctoPrint from the command line with
`octoprint serve --safe`. Then try to reproduce your issue. Find out
more about safe mode in the [docs](http://docs.octoprint.org/en/master/features/safemode.html).
You might also want to try the current development version of OctoPrint
(if you aren't already). Refer to the [FAQ](https://faq.octoprint.org)
for information on how to do this.
3. The problem still exists? Then please **look through the
[existing tickets](https://github.com/foosel/OctoPrint/issues?state=open)
(use the [search](https://github.com/foosel/OctoPrint/search?q=&ref=cmdform&type=Issues))**
to check if there already exists a report of the issue you are encountering.
Sorting through duplicates of the same issue sometimes causes more work than
fixing it. Take the time to filter through possible duplicates and be really
sure that your problem definitely is a new one. Try more than one search query
(e.g. do not only search for "timelapse" if you happen to run into an issue
with your webcam, also search for "recording" etc). Do not only read the subject lines
of tickets that look like they might be related, but also read the ticket itself!
**Very important:** Please make absolutely sure that if you find a bug that looks like
it is the same as your's, it actually behaves the same as your's. E.g. if someone gives steps
to reproduce his bug that looks like your's, reproduce the bug like that if possible,
and only add a "me too" if you actually can reproduce the same
issue. Also **provide all information** as [described below](#what-should-i-include-in-a-bug-report)
and whatever was additionally requested over the course of the ticket
even if you "only" add to an existing ticket. The more information available regarding a bug, the higher
the chances of reproducing and solving it. But "me too" on an actually unrelated ticket
makes it more difficult due to on top of having to figure out the original problem
there's now also a [red herring](https://en.wikipedia.org/wiki/Red_herring) interfering - so please be
very diligent here!
If in doubt about any of the above - get in touch on the [community forum](https://community.octoprint.org)
instead of opening a ticket here. If you are actually running into a bug, we'll figure it out together
there.
### What should I include in a bug report?
First of all make sure your use **a descriptive title**. "It doesn't work"
and similar unspecific complaints are NOT descriptive titles.
**Always use the following template, even if only adding a "me too" to an
existing ticket**:
```
<!--
READ THE FOLLOWING FIRST:
If not already done, please read the the Contribution Guidelines that
are linked to the right under "Helpful resources" > "Contributing".
Also read the FAQ: https://faq.octoprint.org
This is a bug and feature tracker, please only use it to report bugs
or request features within OctoPrint (not OctoPi, not any OctoPrint
plugins and not unofficial OctoPrint versions).
Do not seek support here ("I need help with ...", "I have a
question ..."), that belongs on the community forum at
community.octoprint.org, NOT here.
Mark requests with a "[Request]" prefix in the title please. For bug
reports fully fill out the bug reporting template (if you don't know
where to find some information - it's all described in the Contribution
Guidelines linked up there in the big yellow box).
When reporting a bug do NOT delete ANY lines from the template.
Make sure any bug you want to report is still present with the CURRENT
OctoPrint version and that it does not vanish when you start OctoPrint
in safe mode - how to do that is also explained in the Contribution
Guidelines linked up there in the big yellow box.
Thank you!
-->
#### What were you doing?
<!--
Please be as specific as possible here. The maintainers will need to
reproduce your issue in order to fix it and that is not possible if they
don't know what you did to get it to happen in the first place.
Ideally provide exact steps to follow in order to reproduce your problem:
-->
1. ...
2. ...
3. ...
<!--
If you encountered a problem with specific files of any sorts, make sure
to also include a link to a file with which to reproduce the problem.
-->
#### What did you expect to happen?
#### What happened instead?
#### Did the same happen when running OctoPrint in safe mode?
<!--
Test if you can reproduce your problem in safe mode. You can find information
on how to enable safe mode in the Contribution Guidelines.
If you can't reproduce in safe mode, this is a bug with one of your
installed third party plugins. Don't open a ticket here!
If you can't test this in safe mode, state why.
-->
#### Version of OctoPrint
<!--
Can be found in the lower left corner of the web interface. ALWAYS INCLUDE.
-->
#### Operating System running OctoPrint
<!--
OctoPi, Linux, Windows, MacOS, something else? With version please.
OctoPi's version can be found in /etc/octopi_version or in the lower left
corner of the web interface.
-->
#### Printer model & used firmware incl. version
<!--
If applicable, always include if unsure.
-->
#### Browser and version of browser, operating system running browser
<!--
If applicable, always include if unsure.
-->
#### Link to octoprint.log
<!--
On gist.github.com or pastebin.com. ALWAYS INCLUDE and never truncate.
The Contribution Guidelines tell you where to find that.
-->
#### Link to contents of terminal tab or serial.log
<!--
On gist.github.com or pastebin.com. If applicable, always include if unsure or
reporting communication issues. Never truncate.
serial.log is usually not written due to performance reasons and must be
enabled explicitly. Provide at the very least the FULL contents of your
terminal tab at the time of the bug occurrence, even if you do not have
a serial.log (which the Contribution Guidelines tell you where to find).
-->
#### Link to contents of Javascript console in the browser
<!--
On gist.github.com or pastebin.com or alternatively a screenshot. If applicable -
always include if unsure or reporting UI issues.
The Contribution Guidelines tell you where to find that.
-->
#### Screenshot(s)/video(s) showing the problem:
<!--
If applicable. Always include if unsure or reporting UI issues.
-->
I have read the FAQ.
```
Copy-paste this template **completely** (or use the version that gets pre-filled
into the "new issue" form). Do not skip any lines or the bot *will* complain! Provide
all requested information or your ticket will be closed.
### Where can I find which version and branch I'm on?
Please refer to [this FAQ entry](https://community.octoprint.org/t/how-can-i-find-out-the-version-of-octoprint-or-octopi-i-am-running/204/1).
### Where can I find those log files you keep talking about?
Please refer to [this FAQ entry](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299/1).
### Where can I find my browser's error console?
See [How to open the Javascript Console in different browsers](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers)
## Setting up a development environment
See [the corresponding chapter in the documentation](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment).
This also includes information on how to run the test suite and how to build
the documentation.
## Pull requests
1. If you want to add a new feature to OctoPrint, **please always first
consider if it wouldn't be better suited for a plugin.** As a general rule
of thumb, any feature that is only of interest to a small sub group should
be moved into a plugin. If the current plugin system doesn't allow you to
implement your feature as a plugin, create a "Brainstorming" ticket to get
the discussion going on how best to solve *this* in OctoPrint's plugin
system - maybe that's the actual PR you have been waiting for to contribute :)
2. If you plan to make **any large or otherwise disruptive changes to the
code or appearance, please get in touch on the
[forums](https://community.octoprint.org/c/development)** first so
that we can determine if it's a good time for your specific pull
request. It might be that we're currently in the process of making
heavy changes to the code locations you'd target as well, or your
approach doesn't fit the general "project vision", and that would
just cause unnecessary work and frustration for everyone or
possibly get the PR rejected.
3. Create your pull request **from a custom branch** on your end (e.g.
`dev/myNewFeature`)[1].
4. Create your pull request **only against the `maintenance` or `devel` branch**:
* if it's a bug fix for a bug in the current stable version, an improvement of existing functionality or a
*small* new feature (e.g. a new hook, a new config flag, ...): `maintenance` branch
* otherwise: `devel` branch
5. Create **one pull request per feature/bug fix**.
6. Make sure there are **only relevant changes** included in your PR. No
changes to unrelated files, no additional files that don't belong (e.g.
commits of your full virtual environment). Make sure your PR consists
**ideally of only one commit** (use git's rebase and squash functionality).
7. Make sure you **follow the current coding style**. This means:
* Tabs instead of spaces in the Python files[2]
* Spaces instead of tabs in the JavaScript sources
* English language (code, variables, comments, ...)
* Comments where necessary: Tell *why* the code does something like it does
it, structure your code
* Following the general architecture
* If your PR needs to make changes to the Stylesheets, change the
``.less`` files from which the CSS is compiled.
* Make sure you do not add dead code (e.g. commented out left-overs
from experiments).
8. Ensure your changes **pass the existing unit tests**. PRs that break
those cannot be accepted. You can run the unit tests locally (after
[initial development environment setup with "develop" dependencies](http://docs.octoprint.org/en/master/development/index.html#setting-up-a-development-environment))
by running
```
nosetests --with-doctest
```
in the OctoPrint checkout folder. A [travis build](https://travis-ci.org/foosel/OctoPrint)
is also setup so that if the tests should fail, your PR will be marked
accordingly.
9. **Test your changes thoroughly**. That also means testing with usage
scenarios you don't normally use, e.g. if you only use access control, test
without and vice versa. If you only test with your printer, test with the
virtual printer and vice versa. State in your pull request how you tested
your changes. Ideally **add unit tests** - OctoPrint severely lacks in that
department, but we are trying to change that, so any new code already covered
with a test suite helps a lot!
10. In your pull request's description, **state what your pull request does**,
as in, what feature does it implement, what bug does it fix. The more
thoroughly you explain your intent behind the PR here, the higher the
chances it will get merged fast. There is a template provided below
that can help you here.
11. Don't forget to **add yourself to the [AUTHORS](./AUTHORS.md)
file** :)
Template to use for Pull Request descriptions:
```
#### What does this PR do and why is it necessary?
#### How was it tested? How can it be tested by the reviewer?
#### Any background context you want to provide?
#### What are the relevant tickets if any?
#### Screenshots (if appropriate)
#### Further notes
```
## What do the branches mean?
There are three main branches in OctoPrint:
* `master`: The master branch always contains the current stable release. It
is *only* updated on new releases. Will have a version number following
the scheme `<x>.<y>.<z>` (e.g. `1.2.9`) or - if it's absolutely necessary to
add a commit after release to this branch - `<x>.<y>.<z>.post<commits since x.y.z>`
(e.g. `1.2.9.post1`).
* `maintenance`: Improvements and fixes of the current release that make up
the next release go here. More or less continuously updated. You can consider
this a preview of the next release version. It should be very stable at all
times. Anything you spot in here helps tremendously with getting a rock solid
next stable release, so if you want to help out development, running the
`maintenance` branch and reporting back anything you find is a very good way
to do that. Will usually have a version number following the scheme
`<x>.<y>.<z+1>.dev<commits since increase of z>` for an OctoPrint version of `<x>.<y>.<z>`
(e.g. `1.2.10.dev12`).
* `devel`: Ongoing development of new features that will go into the next bigger
release (MINOR version number increases) will happen on this branch. Usually
kept stable, sometimes stuff can break though or lose backwards compatibility
temporarily. Can be considered the "bleeding edge". All PRs should target
*this* branch. Important improvements and fixes from PRs here are backported to
`maintenance` as needed. Will usually have a version number following the
scheme `<x>.<y+1>.0.dev<commits since increase of y>` for a current OctoPrint version
of `<x>.<y>.<z>` (e.g. `1.3.0.dev123`).
* `rc/maintenance`: This branch is reserved for future releases that have graduated from
the `maintenance` branch and are now being pushed on the "Maintenance"
pre release channel for further testing. Version number follows the scheme
`<x>.<y>.<z>rc<n>` (e.g. `1.2.9rc1`).
* `staging/maintenance`: Any preparation for potential follow-up RCs takes place here.
Version number follows the scheme `<x>.<y>.<z>rc<n+1>.dev<commits since increase of n>` (e.g.
`1.2.9rc1.dev3`) for a current Maintenance RC of `<x>.<y>.<z>rc<n>`.
* `rc/devel`: This branch is reserved for future releases that have graduated from
the `devel` branch and are now being pushed on the "Devel" pre release channel
for further testing. Version number follows the scheme `<x>.<y+1>.0rc<n>` (e.g. `1.3.0rc1`)
for a current stable OctoPrint version of `<x>.<y>.<z>`.
* `staging/devel`: Any preparation for potential follow-up Devel RCs takes place
here. Version number follows the scheme `<x>.<y>.0rc<n+1>.dev<commits since increase of n>` (e.g.
`1.3.0rc1.dev12`) for a current Devel RC of `<x>.<y>.0rc<n>`.
Additionally, from time to time you might see other branches pop up in the repository.
Those usually have one of the following prefixes:
* `fix/...`: Fixes under development that are to be merged into the `maintenance`
and `devel` branches.
* `improve/...`: Improvements under development that are to be merged into the
`maintenance` and `devel` branches.
* `dev/...` or `feature/...`: New functionality under development that is to be merged
into the `devel` branch.
There is also the `gh-pages` branch, which holds OctoPrint's web page, and a few
older development branches that are slowly being migrated or deleted.
## How OctoPrint is versioned
OctoPrint follows the [semantic versioning scheme](http://semver.org/) of **MAJOR.MINOR.PATCH**.
The **PATCH** version number is the one increasing most often due to OctoPrint's maintenance releases.
Releases that only change the patch number indicate that they contain bug fixes and small improvements
of existing functionality. Example: 1.2.8 to 1.2.9.
The **MINOR** version number increases with releases that add a lot of new functionality and
large features. Example: 1.2.x to 1.3.0.
Finally, the **MAJOR** version number increases if there are breaking API changes that concern any of the
documented interfaces (REST API, plugin interfaces, ...). So far this hasn't happened. Example: 1.x.y to 2.0.0.
OctoPrint's version numbers are automatically generated using [versioneer](https://github.com/warner/python-versioneer)
and depend on the selected git branch, nearest git tag and commits. The generated version number
should always be [PEP440](https://www.python.org/dev/peps/pep-0440/) compatible. Unless a git tag
is used for version number determination, the version number will also contain the git hash within
the local version identifier to allow for an exact determination of the active code base
(e.g. `1.2.9.dev68+g46c7a9c`). Additionally, instances with active uncommitted changes will contain
`.dirty` in the local version identifier.
## History
* 2015-01-23: More guidelines for creating pull requests, support/questions
redirected to Mailinglist/G+ community
* 2015-01-27: Added another explicit link to the FAQ
* 2015-07-07: Added step to add yourself to AUTHORS when creating a PR :)
* 2015-12-01: Heavily reworked to include examples, better structure and
all information in one document.
* 2016-02-10: Added information about branch structure and versioning.
* 2016-02-16: Added requirement to add information from template to existing
tickets as well, explained issue with "me too" red herrings.
* 2016-03-14: Some more requirements for PRs, and a PR template.
* 2016-06-08: New `prerelease` and `rc` branches explained.
* 2016-09-09: New `rc/*` branches explained.
* 2016-09-23: Some more work on "How to file a bug report" based on recent
experiences
* 2017-01-25: Fixed a typo
* 2017-03-09: Allow PRs against `maintenance` branch for bugs in stable.
* 2017-03-10: Reproduce bugs in safe mode to make sure they are really caused
by OctoPrint itself and not a misbehaving plugin.
* 2017-03-27: Added safe mode section to ticket template.
* 2017-11-22: Added note on how to run the unit tests
* 2018-03-15: Link to new community forum and some clarifications re bug
reporting
* 2018-03-29: "Where to find version numbers" is now located on the FAQ
* 2018-10-18: Allow PRs against `maintenance` branch for improvements and small
new features, suggest getting in touch on the forum for larger changes
## Footnotes
* [1] - If you are wondering why, the problem is that anything that you add
to your PR's branch will also become part of your PR, so if you create a
PR from your version of `devel` chances are high you'll add changes to the
PR that do not belong to the PR.
* [2] - Yes, we know that this goes against PEP-8. OctoPrint started out as
a fork of Cura and hence stuck to the coding style found therein. Changing
it now would make the history and especially `git blame` completely
unusable, so for now we'll have to deal with it (this decision might be
revisited in the future).
View File
File renamed without changes.
-6
View File
@@ -1,10 +1,4 @@
recursive-include src/octoprint/static *
recursive-include src/octoprint/templates *
recursive-include src/octoprint/plugins *
recursive-include src/octoprint/translations *
include src/octoprint/util/piptestballoon/setup.py
include versioneer.py
include src/octoprint/_version.py
include requirements.txt
include *.md
exclude CONTRIBUTING.md
+36 -105
View File
@@ -1,150 +1,81 @@
# OctoPrint
OctoPrint
=========
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=foosel&url=https://github.com/foosel/OctoPrint&title=OctoPrint&language=&tags=github&category=software)
![GitHub release](https://img.shields.io/github/release/foosel/OctoPrint.svg?colorB=brightgreen)
[![Travis build status](https://img.shields.io/travis/foosel/OctoPrint.svg)](https://travis-ci.org/foosel/OctoPrint)
[![Discourse topics](https://img.shields.io/discourse/https/community.octoprint.org/users.svg)](https://community.octoprint.org)
[![IRC](https://img.shields.io/badge/chat-on%20irc-brightgreen.svg)](https://chat.octoprint.org)
[![Twitter Follow](https://img.shields.io/twitter/follow/OctoPrint3d.svg?style=social&label=Follow)](https://twitter.com/OctoPrint3d)
OctoPrint provides a snappy web interface for controlling consumer 3D printers. It is Free Software
OctoPrint provides a responsive web interface for controlling a 3D printer (RepRap, Ultimaker, ...). It is Free Software
and released under the [GNU Affero General Public License V3](http://www.gnu.org/licenses/agpl.html).
Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=github&utm_medium=readme).
Its website can be found at [octoprint.org](http://octoprint.org).
The community forum is available at [community.octoprint.org](https://community.octoprint.org/?utm_source=github&utm_medium=readme).
Contributing
------------
The official IRC channel is [#octoprint on freenode](https://chat.octoprint.org). Its logs can be found [here](https://freenode.logbot.info/octoprint).
Please see the project's [Contribution Guidelines](https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md).
The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme).
Installation
------------
The documentation is located at [docs.octoprint.org](http://docs.octoprint.org).
Installation instructions for installing from source for different operating systems can be found [on the wiki](https://github.com/foosel/OctoPrint/wiki#assorted-guides).
The official plugin repository can be reached at [plugins.octoprint.org](https://plugins.octoprint.org/?utm_source=github&utm_medium=readme).
**OctoPrint's development wouldn't be possible without the [financial support by its community](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
If you enjoy OctoPrint, please consider becoming a regular supporter!**
![Screenshot](http://i.imgur.com/dF3noFp.png)
You are currently looking at the source code repository of OctoPrint. If you already installed it
(e.g. by using the Raspberry Pi targeted distribution [OctoPi](https://github.com/guysoft/OctoPi)) and only
want to find out how to use it, [the documentation](http://docs.octoprint.org/) and [the public wiki](https://github.com/foosel/OctoPrint/wiki)
might be of more interest for you. You might also want to subscribe to join
[the community forum at community.octoprint.org](https://community.octoprint.org) where there are other active users who might be
able to help you with any questions you might have.
## Contributing
Contributions of all kinds are welcome, not only in the form of code but also with regards to the
[official documentation](http://docs.octoprint.org/) or [the public wiki](https://github.com/foosel/OctoPrint/wiki), debugging help
in the [bug tracker](https://github.com/foosel/OctoPrint/issues), support of other users on
[the community forum at community.octoprint.org](https://community.octoprint.org)
and also [financially](https://octoprint.org/support-octoprint/?utm_source=github&utm_medium=readme).
If you think something is bad about OctoPrint or its documentation the way it is, please help
in any way to make it better instead of just complaining about it -- this is an Open Source Project
after all :)
For information about how to go about submitting bug reports or pull requests, please see the project's
[Contribution Guidelines](https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md).
## Installation
Installation instructions for installing from source for different operating
systems can be found [on the wiki](https://github.com/foosel/OctoPrint/wiki#assorted-guides).
If you want to run OctoPrint on a Raspberry Pi, you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi)
If you want to run OctoPrint on a Raspberry Pi you might want to take a look at [OctoPi](https://github.com/guysoft/OctoPi)
which is a custom SD card image that includes OctoPrint plus dependencies.
The generic steps that should basically be done regardless of operating system
and runtime environment are the following (as *regular
user*, please keep your hands *off* of the `sudo` command here!) - this assumes
you already have Python 2.7, pip and virtualenv set up on your system:
Dependencies
------------
1. Checkout OctoPrint: `git clone https://github.com/foosel/OctoPrint.git`
2. Change into the OctoPrint folder: `cd OctoPrint`
3. Create a user-owned virtual environment therein: `virtualenv venv` if your system default python version is
python 2.7, otherwise you need to specify the version explicitly, e.g. `virtualenv --python=python2.7 venv`.
4. Install OctoPrint *into that virtual environment*: `./venv/bin/pip install .`
OctoPrint depends on a couple of python modules to do its job. Those are automatically installed when installing
OctoPrint via `setup.py`:
You may then start the OctoPrint server via `/path/to/OctoPrint/venv/bin/octoprint`, see [Usage](#usage)
for details.
python setup.py install
After installation, please make sure you follow the first-run wizard and set up
access control as necessary.
## Dependencies
OctoPrint depends on a few python modules to do its job. Those are automatically installed when installing
OctoPrint via `pip`:
pip install .
You should do this every time after pulling from the repository, since the dependencies may have changed.
You should also do this every time after pulling from the repository, since the dependencies might have changed.
OctoPrint currently only supports Python 2.7.
## Usage
Usage
-----
Running the pip install via
pip install .
installs the `octoprint` script in your Python installation's scripts folder
(which, depending on whether you installed OctoPrint globally or into a virtual env, will be in your `PATH` or not). The
following usage examples assume that the `octoprint` script is on your `PATH`.
Running the `setup.py` script installs the `octoprint` script in your Python installation's scripts folder
(which depending on whether you installed OctoPrint globally or into a virtual env will be on your `PATH` or not). The
following usage examples assume that said `octoprint` script is on your `PATH`.
You can start the server via
octoprint serve
octoprint
By default it binds to all interfaces on port 5000 (so pointing your browser to `http://127.0.0.1:5000`
will do the trick). If you want to change that, use the additional command line parameters `host` and `port`,
which accept the host ip to bind to and the numeric port number respectively. If for example you want the server
to only listen on the local interface on port 8080, the command line would be
octoprint serve --host=127.0.0.1 --port=8080
octoprint --host=127.0.0.1 --port=8080
Alternatively, the host and port on which to bind can be defined via the config file.
Alternatively, the host and port on which to bind can be defined via the configuration.
If you want to run OctoPrint as a daemon (only supported on Linux), use
octoprint daemon {start|stop|restart} [--pid PIDFILE]
octoprint --daemon {start|stop|restart} [--pid PIDFILE]
If you do not supply a custom pidfile location via `--pid PIDFILE`, it will be created at `/tmp/octoprint.pid`.
You can also specify the config file or the base directory (for basing off the `uploads`, `timelapse` and `logs` folders),
You can also specify the configfile or the base directory (for basing off the `uploads`, `timelapse` and `logs` folders),
e.g.:
octoprint serve --config /path/to/another/config.yaml --basedir /path/to/my/basedir
octoprint --config /path/to/another/config.yaml --basedir /path/to/my/basedir
To start OctoPrint in safe mode - which disables all third party plugins that do not come bundled with OctoPrint - use
the ``--safe`` flag:
See `octoprint --help` for further information.
octoprint serve --safe
See `octoprint --help` for more information on the available command line parameters.
OctoPrint also ships with a `run` script in its source directory. You can invoke it to start the server. It
OctoPrint also ships with a `run` script in its source directory. You can also invoke that to start up the server, it
takes the same command line arguments as the `octoprint` script.
## Configuration
Configuration
-------------
If not specified via the command line, the config file `config.yaml` for OctoPrint is expected in the settings folder,
If not specified via the commandline, the configfile `config.yaml` for OctoPrint is expected in the settings folder,
which is located at `~/.octoprint` on Linux, at `%APPDATA%/OctoPrint` on Windows and
at `~/Library/Application Support/OctoPrint` on MacOS.
A comprehensive overview of all available configuration settings can be found
[in the docs](http://docs.octoprint.org/en/master/configuration/config_yaml.html).
Please note that the most commonly used configuration settings can also easily
be edited from OctoPrint's settings dialog.
## Special Thanks
Cross-browser testing services are kindly provided by [BrowserStack](https://www.browserstack.com/).
Profiling is done with the help of [PyVmMonitor](https://www.pyvmmonitor.com).
Error tracking is powered and sponsored by [Sentry](https://sentry.io).
[on the wiki](https://github.com/foosel/OctoPrint/wiki/Configuration). Please note that the most commonly used
configuration settings can also easily be edited from OctoPrint's settings dialog.
-59
View File
@@ -1,59 +0,0 @@
# Supporters
Development of this version of OctoPrint wouldn't have been possible without
[the financial support by the community](https://octoprint.org/support-octoprint/) -
thanks to everyone who contributed!
## Patreon Patrons
* Andre Bubel
* Andrew Moorby
* ANTONIO AUGUSTO DE LIMA PONTES
* Arnljot Arntsen
* Boris Hussein
* Brad Jackson
* Christian Petropolis
* Christian Wolf
* COLLE+McVOY
* D Brian Kimmel
* DeltaMaker 3D Printers
* Dorian Gray
* E3D BigBox
* Eric Betts
* Ernesto Martinez
* Franziska Kunsmann
* George Robles
* jean-claude migneault
* Jeff Renfer
* Jefferson Hunt
* Jeremiah Avery
* Joshua Wills
* Justin Kaufman
* Kaile Riser
* Kale Stedman
* Kazuhiro Ogura
* LA 3D Printer Repair
* LulzBot®
* Makespace Madrid
* Mark Walker
* Michael Aumock
* Miles Flavel
* Mosaic Manufacturing
* OMER MEHMET SUTAS
* Patrick Glyré
* Patrick McGinnis
* Prof Yuh Wen Chen
* Randy C. Will
* Ranjib Dey
* Robert Gusek
* Samer Najia
* Shawn Lewis
* Simon Hallam
* Stefan Krister
* Sven Mueller
* TEVO 3D Printers
* Trent Shumay
* Ulrich Kempken
* Vladislav Kuzemchik
and 1587 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)!
-76
View File
@@ -1,76 +0,0 @@
# Third Party Licenses
## Web Interface
* [AVLTree](https://gist.github.com/viking/2424106) (modified): GPL, LGPL (dual licensed)
* [Babel JavaScript Support](https://github.com/mitsuhiko/babel/blob/master/contrib/babel.js): BSD
* [Bootstrap](http://getbootstrap.com/): Apache License 2.0
* [Bootstrap Modal](http://jschr.github.io/bootstrap-modal/): Apache License 2.0
* [Bootstrap Slider Knockout Binding](https://github.com/cosminstefanxp/bootstrap-slider-knockout-binding): MIT
* [Bootstrap Slider](http://seiyria.com/bootstrap-slider/): Apache License 2.0
* [Bootstrap Tabdrop](http://www.eyecon.ro/bootstrap-tabdrop): Apache License 2.0
* [Detect Mobile Browser](http://detectmobilebrowsers.com/): Public Domain
* [Flot](http://www.flotcharts.org/): MIT
* [JavaScript MD5](https://github.com/blueimp/JavaScript-MD5): MIT
* [JQuery](http://jquery.com/): MIT
* [JQuery Bootstrap Wizard](http://github.com/VinceG/twitter-bootstrap-wizard): MIT, GPL (dual licensed)
* [JQuery File Upload](https://github.com/blueimp/jQuery-File-Upload): MIT
* [JQuery iframe transport](https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.iframe-transport.js): MIT
* [JQuery QRCode](http://larsjung.de/jquery-qrcode/): MIT
* [JQuery Slimscroll](http://rocha.la/jQuery-slimScroll): MIT, GPL (dual licensed)
* [JQuery UI Core, Mouse, Slider and Widget](http://jqueryui.com): MIT
* [Knockout](http://knockoutjs.com/): MIT
* [LESS](http://lesscss.org): Apache License 2.0
* [lodash](https://lodash.com): MIT
* [Loglevel](https://github.com/pimterry/loglevel): MIT
* [Modernizr](http://modernizr.com): MIT
* [Moment.js](http://momentjs.com/): MIT
* [PNotify](http://sciactive.com/pnotify/): GPL, LGPL, MPL (triple licensed)
* [pusher.color.js](http://cache.preserve.io/5g18q0pw/index.html) (original link dead): MIT
* [SockJS](https://github.com/sockjs/sockjs-client): MIT
* [sprintf-js](http://alexei.ro/): BSD
## Server
* [appdirs](http://github.com/ActiveState/appdirs): MIT
* [Awesome-Slugify](https://pypi.python.org/pypi/awesome-slugify): GPLv3
* [chainmap](https://bitbucket.org/jeunice/chainmap): Python
* [Click](http://click.pocoo.org/): BSD
* [emoji](https://github.com/carpedm20/emoji/): BSD
* [feedparser](https://github.com/kurtmckee/feedparser): BSD
* [Flask](http://flask.pocoo.org/): BSD
* [Flask-Assets](http://github.com/miracle2k/flask-assets): BSD
* [Flask-Babel](http://github.com/mitsuhiko/flask-babel): BSD
* [Flask-Login](https://github.com/maxcountryman/flask-login): MIT
* [Flask-Markdown](http://github.com/dcolish/flask-markdown): BSD
* [Flask-Principal](http://packages.python.org/Flask-Principal/): MIT
* [future](https://python-future.org/): MIT
* [futures](https://github.com/agronholm/pythonfutures): Python
* [monotonic](https://github.com/atdt/monotonic): Apache License 2.0
* [netaddr](https://github.com/drkjam/netaddr/): BSD
* [netifaces](https://bitbucket.org/al45tair/netifaces): MIT
* [pkginfo](http://pypi.python.org/pypi/pkginfo/): Python
* [psutil](https://github.com/giampaolo/psutil): BSD
* [pylru](https://github.com/jlhutch/pylru): GPLv2
* [pyserial](http://pyserial.sourceforge.net/): Python
* [PyYAML](http://pyyaml.org/wiki/PyYAML): MIT
* [requests](http://python-requests.org/): Apache License 2.0
* [rsa](http://stuvel.eu/rsa): Apache License 2.0
* [sarge](http://sarge.readthedocs.org/): BSD
* [scandir](https://github.com/benhoyt/scandir): BSD
* [semantic_version](https://github.com/rbarrois/python-semanticversion): BSD
* [SockJS-Tornado](http://github.com/mrjoes/sockjs-tornado/): MIT
* [Tornado](http://www.tornadoweb.org/): Apache License 2.0
* [watchdog](http://github.com/gorakhargosh/watchdog): Apache License 2.0
* [websocket-client](https://github.com/liris/websocket-client): LGPLv3
* [wrapt](http://wrapt.readthedocs.org/): BSD
## Development (testing, documentation generation, etc)
* [ddt](https://github.com/txels/ddt): MIT
* [mock](https://github.com/testing-cabal/mock): BSD
* [nose](http://pythonhosted.org/nose/): LGPL
* [Sphinx](http://sphinx-doc.org/): BSD
* [sphinxcontrib-httpdomain](https://bitbucket.org/birkenfeld/sphinx-contrib/src/default/httpdomain/): BSD
* [sphinxcontrib-mermad](https://github.com/mgaitan/sphinxcontrib-mermaid): BSD
* [sphinx_rtd_theme](https://github.com/snide/sphinx_rtd_theme/): BSD
+1 -3
View File
@@ -1,8 +1,6 @@
[python: src/octoprint/**.py]
[jinja2: src/octoprint/templates/**.jinja2]
[jinja2: src/octoprint/plugins/**.jinja2]
extensions=jinja2.ext.autoescape, jinja2.ext.with_, webassets.ext.jinja2.AssetsExtension
extensions=jinja2.ext.autoescape, jinja2.ext.with_
[javascript: src/octoprint/static/js/app/**.js]
[javascript: src/octoprint/plugins/**.js]
extract_messages = gettext, ngettext
-60
View File
@@ -1,60 +0,0 @@
/* override table width restrictions */
.wy-table-responsive table td, .wy-table-responsive table th {
/* !important prevents the common CSS stylesheets from
overriding this as on RTD they are loaded after this stylesheet */
white-space: normal !important;
}
.wy-table-responsive {
overflow: visible !important;
}
/* style headlink for code block captions like other headlinks */
.code-block-caption .headerlink {
display: none;
visibility: hidden;
font-size: 14px;
font-family: inherit;
font-style: normal;
font-weight: normal;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
.code-block-caption:hover .headerlink {
display: inline-block;
}
.code-block-caption .headerlink:after {
visibility: visible;
content: "\f0c1";
font-family: FontAwesome;
display: inline-block;
}
/* make whitespace visualization in code listings not appear on same vertical position as dashes */
.highlight .w {
vertical-align: 10%;
}
.rst-content .highlight>pre,
.rst-content .linenodiv>pre {
line-height: 1.5;
}
/* make code tags non-red again */
code,
.rst-content tt {
color: #000 !important;
}
a code,
.rst-content a tt {
color: #2980B9 !important;
}
a:visited code,
.rst-content a:visited tt {
color: #9B59B6 !important;
}
-4
View File
@@ -11,10 +11,6 @@ Apps
Session Keys
============
.. deprecated:: 1.3.11
This functionality will be removed in 1.4.0. Use the :ref:`Application Keys Plugin workflow <sec-bundledplugins-appkeys-workflow>` instead.
OctoPrint offers a special API key type for apps to use, the so called App Session Key. These keys have a time based
validity and are generated by OctoPrint for requesting apps.
+4 -29
View File
@@ -39,7 +39,7 @@ Get connection settings
"options": {
"ports": ["/dev/ttyACM0", "VIRTUAL"],
"baudrates": [250000, 230400, 115200, 57600, 38400, 19200, 9600],
"printerProfiles": [{"name": "Default", "id": "_default"}],
"printerProfiles": [{"name": "Default", id: "_default"}],
"portPreference": "/dev/ttyACM0",
"baudratePreference": 250000,
"printerProfilePreference": "_default",
@@ -59,7 +59,7 @@ Issue a connection command
Issue a connection command. Currently available command are:
connect
Instructs OctoPrint to connect or, if already connected, reconnect to the printer. Additional parameters are:
Instructs OctoPrint to connect to the printer. Additional parameters are:
* ``port``: Optional, specific port to connect to. If not set the current ``portPreference`` will be used, or if
no preference is available auto detection will be attempted.
@@ -75,14 +75,6 @@ Issue a connection command
disconnect
Instructs OctoPrint to disconnect from the printer.
fake_ack
Fakes an acknowledgment message for OctoPrint in case one got lost on the serial line and the communication
with the printer since stalled. This should only be used in "emergencies" (e.g. to save prints), the reason
for the lost acknowledgment should always be properly investigated and removed instead of depending on this
"symptom solver".
Requires user rights.
**Example Connect Request**
.. sourcecode:: http
@@ -122,24 +114,7 @@ Issue a connection command
HTTP/1.1 204 No Content
**Example FakeAck Request**
.. sourcecode:: http
POST /api/connection HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "fake_ack"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``connect``, ``disconnect`` or ``fake_ack``.
:json string command: The command to issue, either ``connect`` or ``disconnect``
:json string port: ``connect`` command: The port to connect to. If left out either the existing ``portPreference``
will be used, or if that is not available OctoPrint will attempt auto detection. Must be part
of the available ports.
@@ -154,4 +129,4 @@ Issue a connection command
startup. If not set no changes will be made to the current setting.
:statuscode 204: No error
:statuscode 400: If the selected `port` or `baudrate` for a ``connect`` command are not part of the available
options.
options.
+46 -176
View File
@@ -31,7 +31,7 @@ Printer State
* - ``flags``
- 1
- Printer state flags
- A few boolean printer state flags
- A couple of boolean printer state flags
* - ``flags.operational``
- 1
- Boolean
@@ -44,14 +44,6 @@ Printer State
- 1
- Boolean
- ``true`` if the printer is currently printing, ``false`` otherwise
* - ``flags.pausing``
- 1
- Boolean
- ``true`` if the printer is currently printing and in the process of pausing, ``false`` otherwise
* - ``flags.cancelling``
- 1
- Boolean
- ``true`` if the printer is currently printing and in the process of pausing, ``false`` otherwise
* - ``flags.sdReady``
- 1
- Boolean
@@ -218,17 +210,6 @@ Progress information
- 1
- Integer
- Estimate of time left to print, in seconds
* - ``printTimeLeftOrigin``
- 1
- String
- Origin of the current time left estimate. Can currently be either of:
* ``linear``: based on an linear approximation of the progress in file in bytes vs time
* ``analysis``: based on an analysis of the file
* ``estimate``: calculated estimate after stabilization of linear estimation
* ``average``: based on the average total from past prints of the same model against the same printer profile
* ``mixed-analysis``: mixture of ``estimate`` and ``analysis``
* ``mixed-average``: mixture of ``estimate`` and ``average``
.. _sec-api-datamodel-files:
@@ -251,78 +232,11 @@ File information
* - ``name``
- 1
- String
- The name of the file without path. E.g. "file.gco" for a file "file.gco" located anywhere in the file system. Currently
this will always fit into ASCII.
* - ``display``
- 1
- String
- The name of the file without the path, this time potentially with non-ASCII unicode characters.
E.g. "a turtle 🐢.gco" for a file "a_turtle_turtle.gco" located anywhere in the file system.
* - ``path``
- 1
- String
- The path to the file within the location. E.g. "folder/subfolder/file.gco" for a file "file.gco" located within
"folder" and "subfolder" relative to the root of the location. Currently this will always fit into ASCII.
* - ``type``
- 1
- String
- Type of file. ``model`` or ``machinecode``. Or ``folder`` if it's a folder, in which case the ``children``
node will be populated
* - ``typePath``
- 1
- list
- Path to type of file in extension tree. E.g. ``["model", "stl"]`` for ``.stl`` files, or ``["machinecode", "gcode"]``
for ``.gcode`` files. ``["folder"]`` for folders.
Additional properties depend on ``type``.
For a ``type`` value of ``folder``, see :ref:`Folders <sec-api-datamodel-files-folders>`.
For any other value see :ref:`Files <sec-api-datamodel-files-files>`.
.. _sec-api-datamodel-files-folders:
Folders
'''''''
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``children``
- 0..*
- Array of :ref:`File information items <sec-api-datamodel-files-file>`
- Contained children for entries of type ``folder``. On non recursive listings only present on first level
sub folders!
- The name of the file
* - ``size``
- 0..1
- Number
- The size of all files contained in the folder and its subfolders. Not present in non recursive listings!
.. _sec-api-datamodel-files-files:
Files
'''''
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``hash``
- 0..1
- String
- MD5 hash of the file. Only available for ``local`` files.
* - ``size``
- 0..1
- Number
- The size of the file in bytes. Only available for ``local`` files or ``sdcard`` files if the printer
supports file sizes for sd card files.
- The size of the file in bytes. Only available for ``local`` files.
* - ``date``
- 0..1
- Unix timestamp
@@ -340,44 +254,10 @@ Files
- 0..1
- :ref:`GCODE analysis information <sec-api-datamodel-files-gcodeanalysis>`
- Information from the analysis of the GCODE file, if available. Left out in abridged version.
.. _sec-api-datamodel-files-fileabridged:
Abridged file or folder information
-----------------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- String
- The name of the file or folder without path. E.g. "file.gco" for a file "file.gco" located anywhere in the file system.
Currently this will always fit into ASCII.
* - ``display``
- 1
- String
- The name of the file without the path, this potentially with non-ASCII unicode characters.
E.g. "a turtle 🐢.gco" for a file "a_turtle_turtle.gco" located anywhere in the file system.
* - ``path``
- 1
- String
- The path to the file or folder within the location. E.g. "folder/subfolder/file.gco" for a file "file.gco" located within
"folder" and "subfolder" relative to the root of the location. Currently this will always fit into ASCII.
* - ``origin``
- 1
- String, either ``local`` or ``sdcard``
- The origin of the file, ``local`` when stored in OctoPrint's ``uploads`` folder, ``sdcard`` when stored on the
printer's SD card (if available)
* - ``refs``
* - ``prints``
- 0..1
- :ref:`sec-api-datamodel-files-ref`
- References relevant to this file or folder, left out in abridged version
- :ref:`Print history <sec-api-datamodel-files-prints>`
- Information regarding prints of this file, if available. Left out in abridged version.
.. _sec-api-datamodel-files-gcodeanalysis:
@@ -400,60 +280,50 @@ GCODE analysis information
- 0..1
- Object
- The estimated usage of filament
* - ``filament.tool{n}.length``
* - ``filament.length``
- 0..1
- Integer
- The length of filament used, in mm
* - ``filament.tool{n}.volume``
* - ``filament.volume``
- 0..1
- Float
- The volume of filament used, in cm³
* - ``dimensions``
- 0..1
- Object
- Information regarding the size of the printed model
* - ``dimensions.depth``
- 0..1
- Float
- The depth of the printed model, in mm
* - ``dimensions.height``
- 0..1
- Float
- The height of the printed model, in mm
* - ``dimensions.width``
- 0..1
- Float
- The width of the printed model, in mm
* - ``printingArea``
- 0..1
- Object
- Information regarding the size of the printing area
* - ``printingArea.maxX``
- 0..1
- Float
- The maximum X coordinate of the printed model, in mm
* - ``printingArea.maxY``
- 0..1
- Float
- The maximum Y coordinate of the printed model, in mm
* - ``printingArea.maxZ``
- 0..1
- Float
- The maximum Z coordinate of the printed model, in mm
* - ``printingArea.minX``
- 0..1
- Float
- The minimum X coordinate of the printed model, in mm
* - ``printingArea.minY``
- 0..1
- Float
- The minimum Y coordinate of the printed model, in mm
* - ``printingArea.minZ``
- 0..1
- Float
- The minimum Z coordinate of the printed model, in mm
.. _sec-api-datamodel-files-prints:
Print history
-------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``failure``
- 1
- Number
- The number of failed prints on record for the file
* - ``success``
- 1
- Number
- The number of successful prints on record for the file
* - ``last``
- 0..1
- Object
- Information regarding the last print on record for the file
* - ``last.date``
- 1
- Unix timestamp
- Timestamp when this file was printed last
* - ``last.success``
- 1
- Boolean
- Whether the last print on record was a success (``true``) or not (``false``)
.. _sec-api-datamodel-files-ref:
References
@@ -470,13 +340,13 @@ References
* - ``resource``
- 1
- URL
- The resource that represents the file or folder (e.g. for issuing commands to or for deleting)
- The resource that represents the file (e.g. for issuing commands to or for deleting)
* - ``download``
- 0..1
- URL
- The download URL for the file. Never present for folders.
- The download URL for the file
* - ``model``
- 0..1
- URL
- The model from which this file was generated (e.g. an STL, currently not used). Never present for
folders.
- The model from which this file was generated (e.g. an STL, currently not used)
+505
View File
@@ -0,0 +1,505 @@
.. _sec-api-fileops:
***************
File operations
***************
.. contents::
.. _sec-api-fileops-retrieveall:
Retrieve all files
==================
.. http:get:: /api/files
Retrieve information regarding all files currently available and regarding the disk space still available
locally in the system.
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
**Example**:
.. sourcecode:: http
GET /api/files HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files": [
{
"name": "whistle_v2.gcode",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
},
{
"name": "whistle_.gco",
"origin": "sdcard",
"refs": {
"resource": "http://example.com/api/files/sdcard/whistle_.gco"
}
}
],
"free": "3.2GB"
}
:statuscode 200: No error
.. _sec-api-fileops-retrievelocation:
Retrieve files from specific location
=====================================
.. http:get:: /api/files/(string:location)
Retrieve information regarding the files currently available on the selected `location` and -- if targeting
the ``local`` location -- regarding the disk space still available locally in the system.
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
**Example**:
.. sourcecode:: http
GET /api/files/local HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files": [
{
"name": "whistle_v2.gcode",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
}
],
"free": "3.2GB"
}
:param location: The origin location from which to retrieve the files. Currently only ``local`` and ``sdcard`` are
supported, with ``local`` referring to files stored in OctoPrint's ``uploads`` folder and ``sdcard``
referring to files stored on the printer's SD card (if available).
:statuscode 200: No error
:statuscode 404: If `location` is neither ``local`` nor ``sdcard``
.. _sec-api-fileops-uploadfile:
Upload file
===========
.. http:post:: /api/files/(string:location)
Upload a file to the selected `location`.
Other than most of the other requests on OctoPrint's API which are expected as JSON, this request is expected as
``Content-Type: multipart/form-data`` due to the included file upload.
Returns a :http:statuscode:`201` response with a ``Location`` header set to the management URL of the uploaded
file and an :ref:`Upload Response <sec-api-fileops-datamodel-uploadresponse>` as the body upon successful completion.
**Example**
.. sourcecode:: http
POST /api/files/sdcard HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryDeC2E3iWbTv1PwMC
------WebKitFormBoundaryDeC2E3iWbTv1PwMC
Content-Disposition: form-data; name="file"; filename="whistle_v2.gcode"
Content-Type: application/octet-stream
;Generated with Cura_SteamEngine 13.11.2
M109 T0 S220.000000
T0
;Sliced at: Wed 11-12-2013 16:53:12
;Basic settings: Layer height: 0.2 Walls: 0.8 Fill: 20
;Print time: #P_TIME#
;Filament used: #F_AMNT#m #F_WGHT#g
;Filament cost: #F_COST#
;M190 S70 ;Uncomment to add your own bed temperature line
;M109 S220 ;Uncomment to add your own temperature line
G21 ;metric values
G90 ;absolute positioning
...
------WebKitFormBoundaryDeC2E3iWbTv1PwMC
Content-Disposition: form-data; name="select"
true
------WebKitFormBoundaryDeC2E3iWbTv1PwMC
Content-Disposition: form-data; name="print"
true
------WebKitFormBoundaryDeC2E3iWbTv1PwMC--
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
Location: http://example.com/api/files/sdcard/whistle_.gcode
{
"files": {
"local": {
"name": "whistle_v2.gcode",
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
}
},
"sdcard": {
"name": "whistle_.gco",
"origin": "sdcard",
"refs": {
"resource": "http://example.com/api/files/sdcard/whistle_.gco"
}
}
},
"done": true
}
:param location: The target location to which to upload the file. Currently only ``local`` and ``sdcard`` are supported
here, with ``local`` referring to OctoPrint's ``uploads`` folder and ``sdcard`` referring to
the printer's SD card. If an upload targets the SD card, it will also be stored locally first.
:form file: The file to upload, including a valid ``filename``.
:form select: Whether to select the file directly after upload (``true``) or not (``false``). Optional, defaults
to ``false``.
:form print: Whether to start printing the file directly after upload (``true``) or not (``false``). If set, `select`
is implicitely ``true`` as well. Optional, defaults to ``false``.
:statuscode 201: No error
:statuscode 400: If no `file` is included in the request, or the request is otherwise invalid.
:statuscode 404: If `location` is neither ``local`` nor ``sdcard`` or trying to upload to SD card and SD card support
is disabled
:statuscode 409: If the upload of the file would override the file that is currently being printed or if an upload
to SD card was requested and the printer is either not operational or currently busy with a print job.
:statuscode 415: If the file is neither a ``gcode`` nor an ``stl`` file (or it is an ``stl`` file but slicing support
is disabled)
:statuscode 500: If the upload failed internally
.. _sec-api-fileops-retrievefileinfo:
Retrieve a specific file's information
======================================
.. http:get:: /api/files/(string:location)/(path:filename)
Retrieves the selected file's information.
If the file is unknown, a :http:statuscode:`404` is returned.
On success, a :http:statuscode:`200` is returned, with a :ref:`file information item <sec-api-datamodel-files-file>`
as the response body.
**Example**
.. sourcecode:: http
GET /api/files/local/whistle_v2.gcode HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "whistle_v2.gcode",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
}
:param location: The location of the file for which to retrieve the information, either ``local`` or ``sdcard``.
:param filename: The filename of the file for which to retrieve the information
:statuscode 200: No error
:statuscode 404: If `target` is neither ``local`` nor ``sdcard``, ``sdcard`` but SD card support is disabled or the
requested file was not found
.. _sec-api-fileops-filecommand:
Issue a file command
====================
.. http:post:: /api/files/(string:target)/(path:filename)
Issue a file command to an existing file. Currently supported commands are:
select
Selects a file for printing. Additional parameters are:
* ``print``: Optional, if set to ``true`` the file will start printing directly after selection. If the printer
is not operational when this parameter is present and set to ``true``, the request will fail with a response
of ``409 Conflict``.
slice
Slices an STL file into GCODE. Note that this is an asynchronous operation that will take place in the background
after the response has been sent back to the client. Additional parameters are:
* ``slicer``: The slicing engine to use, defaults to ``cura`` if not set, which is also the only supported slicer right now.
* ``gcode``: Name of the GCODE file to generated, in the same location as the STL file. Defaults to the STL file name
with extension ``.gco`` if not set.
* ``position``: Position of the object-to-slice's center on the print bed. A dictionary containing both ``x`` and ``y``
coordinate in mm is expected
* ``printerProfile``: Name of the printer profile to use, if not set the default printer profile will be used.
* ``profile``: Name of the slicing profile to use, if not set the default slicing profile of the slicer will be used.
* ``profile.*``: Override parameters, the ``profile.`` prefix will be stripped and the matching profile key will
be overridden with the supplied value. Use this if you want to specify things that change often like a different
temperature, filament diameter or infill percentage. Profile keys are slicer specific.
* ``select``: Optional, if set to ``true`` the file be selected for printing right after the slicing has finished. If the
printer is not operational or already printing when this parameter is present and set to ``true``, the request will
fail with a response of ``409 Conflict``
* ``print``: Optional, if set to ``true`` the file be selected and start printing right after the slicing has finished.
If the printer is not operational or already printing when this parameter is present and set to ``true``, the request
will fail with a response of ``409 Conflict``. Note that if this parameter is set, the parameter ``select`` does not
need to be set, it is automatically assumed to be ``true`` too, otherwise no printing would be possible.
If consecutive slicing calls are made targeting the same GCODE filename (that also holds true if the default is used),
the slicing job already running in the background will be cancelled before the new one is started. Note that this will
also mean that if it was supposed to be directly selected and start printing after the slicing finished, this will not
take place anymore and whether this will happen with the new sliced file depends entirely on the new request!
Upon success, a status code of :http:statuscode:`204` and an empty body is returned, unless specified otherwise.
**Example Select Request**
.. sourcecode:: http
POST /api/files/local/whistle_v2.gcode HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "select",
"print": true
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Slice Request**
.. sourcecode:: http
POST /api/files/local/some_model.stl HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "slice",
"slicer": "cura",
"gcode": "some_model.first_try.gcode",
"printerProfile": "my_custom_reprap",
"profile": "high_quality",
"profile.infill": 75,
"profile.fill_density": 15,
"position": {"x": 100, "y": 100},
"print": true
}
.. sourcecode:: http
HTTP/1.1 202 Accepted
Content-Type: application/json
{
"origin": "local",
"name": "some_model.first_try.gcode",
"refs": {
"download": "http://example.com/downloads/files/local/some_model.first_try.gcode",
"resource": "http://example.com/api/files/local/some_model.first_try.gcode"
}
}
:param target: The target location on which to delete the file, either ``local`` (for OctoPrint's ``uploads``
folder) or ``sdcard`` for the printer's SD card (if available)
:param filename: The filename of the file for which to issue the command
:json string command: The command to issue for the file, currently only ``select`` is supported
:json boolean print: ``select`` and ``slice`` command: Optional, whether to start printing the file directly after selection
or slicing, defaults to ``false``.
:json string slicer: ``slice`` command: The slicer to use, defaults to the default slicer.
:json string gcode: ``slice`` command: The name of the gcode file to create, defaults to the targeted stl's file name
with its extension changed to ``.gco`` (e.g. "test.stl" will be sliced to "test.gco" if not specified
otherwise)
:json string profile: ``slice`` command: The slicing profile to use, defaults to the selected slicer's default profile.
:json string profile.*: ``slice`` command: Overrides for the selected slicing profile, e.g. to specify a different temperature
or filament diameter.
:json string printerProfile: ``slice`` command: The printer profile to use, defaults to the default printer profile.
:json boolean select: ``slice`` command: Optional, whether to select the file for printing directly after slicing,
defaults to ``false``
:statuscode 200: No error for a ``select`` command.
:statuscode 202: No error for a ``slice`` command.
:statuscode 400: If the ``command`` is unknown or the request is otherwise invalid
:statuscode 415: If a ``slice`` command was issued against something other than an STL file.
:statuscode 404: If `target` is neither ``local`` nor ``sdcard`` or the requested file was not found
:statuscode 409: If a selected file is supposed to start printing directly but the printer is not operational or
if a file to be sliced is supposed to be selected or start printing directly but the printer
is not operational or already printing.
.. _sec-api-fileops-delete:
Delete file
===========
.. http:delete:: /api/files/(string:target)/(path:filename)
Delete the selected `filename` on the selected `target`.
If the file to be deleted is currently being printed, a :http:statuscode:`409` will be returned.
Returns a :http:statuscode:`204` after successful deletion.
**Example Request**
.. sourcecode:: http
DELETE /api/files/local/whistle_v2.gcode HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
:param target: The target location on which to delete the file, either ``local`` (for OctoPrint's ``uploads``
folder) or ``sdcard`` for the printer's SD card (if available)
:param filename: The filename of the file to delete
:statuscode 204: No error
:statuscode 404: If `target` is neither ``local`` nor ``sdcard`` or the requested file was not found
:statuscode 409: If the file to be deleted is currently being printed
.. _sec-api-fileops-datamodel:
Datamodel
=========
.. _sec-api-fileops-datamodel-retrieveresponse:
Retrieve response
-----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``files``
- 0..*
- Array of :ref:`File information items <sec-api-datamodel-files-file>`
- The list of requested files. Might be an empty list if no files are available
* - ``free``
- 0..1
- String
- The amount of disk space in bytes available in the local disk space (refers to OctoPrint's ``uploads`` folder). Only
returned if file list was requested for origin ``local`` or all origins.
.. _sec-api-fileops-datamodel-uploadresponse:
Upload response
---------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``files``
- 1
- Object
- Abridged information regarding the file that was just uploaded. If only uploaded to ``local`` this will only
contain the ``local`` property. If uploaded to SD card, this will contain both ``local`` and ``sdcard`` properties.
* - ``files.local``
- 1
- :ref:`sec-api-datamodel-files-file`
- The information regarding the file that was just uploaded to the local storage (only the fields ``name``,
``origin`` and ``refs`` will be set).
* - ``files.sdcard``
- 0..1
- :ref:`sec-api-datamodel-files-file`
- The information regarding the file that was just uploaded to the printer's SD card (only the fields ``name``,
``origin`` and ``refs`` will be set).
* - ``done``
- 1
- Boolean
- Whether the file processing after upload has already finished (``true``) or not, e.g. due to first needing
to perform a slicing step (``false``). Clients may use this information to direct progress displays related to
the upload.
-859
View File
@@ -1,859 +0,0 @@
.. _sec-api-fileops:
***************
File operations
***************
.. contents::
.. _sec-api-fileops-retrieveall:
Retrieve all files
==================
.. http:get:: /api/files
Retrieve information regarding all files currently available and regarding the disk space still available
locally in the system.
By default only returns the files and folders in the root directory. If the query parameter ``recursive``
is provided and set to ``true``, returns all files and folders.
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
**Example 1**:
Fetch only the files and folders from the root folder.
.. sourcecode:: http
GET /api/files HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files": [
{
"name": "whistle_v2.gcode",
"path": "whistle_v2.gcode",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"hash": "...",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
},
{
"name": "whistle_.gco",
"path": "whistle_.gco",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"origin": "sdcard",
"refs": {
"resource": "http://example.com/api/files/sdcard/whistle_.gco"
}
},
{
"name": "folderA",
"path": "folderA",
"type": "folder",
"typePath": ["folder"],
"children": [
{
"name": "whistle_v2_copy.gcode",
"path": "whistle_v2_copy.gcode",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"hash": "...",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/folderA/whistle_v2_copy.gcode",
"download": "http://example.com/downloads/files/local/folderA/whistle_v2_copy.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
}
]
}
],
"free": "3.2GB"
}
**Example 2**
Recursively fetch all files and folders.
Fetch only the files and folders from the root folder.
.. sourcecode:: http
GET /api/files?recursive=true HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files": [
{
"name": "whistle_v2.gcode",
"path": "whistle_v2.gcode",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"hash": "...",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
},
{
"name": "whistle_.gco",
"path": "whistle_.gco",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"origin": "sdcard",
"refs": {
"resource": "http://example.com/api/files/sdcard/whistle_.gco"
}
},
{
"name": "folderA",
"path": "folderA",
"type": "folder",
"typePath": ["folder"],
"children": [
{
"name": "test.gcode",
"path": "folderA/test.gcode",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"hash": "...",
"size": 1234,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/folderA/test.gcode",
"download": "http://example.com/downloads/files/local/folderA/test.gcode"
}
},
{
"name": "subfolder",
"path": "folderA/subfolder",
"type": "folder",
"typePath": ["folder"],
"children": [
{
"name": "test.gcode",
"path": "folderA/subfolder/test2.gcode",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"hash": "...",
"size": 100,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/folderA/subfolder/test2.gcode",
"download": "http://example.com/downloads/files/local/folderA/subfolder/test2.gcode"
}
},
],
"size": 100,
"refs": {
"resource": "http://example.com/api/files/local/folderA/subfolder",
}
}
],
"size": 1334,
"refs": {
"resource": "http://example.com/api/files/local/folderA",
}
}
],
"free": "3.2GB"
}
:param recursive: If set to ``true``, return all files and folders recursively. Otherwise only return items on same level.
:statuscode 200: No error
.. _sec-api-fileops-retrievelocation:
Retrieve files from specific location
=====================================
.. http:get:: /api/files/(string:location)
Retrieve information regarding the files currently available on the selected `location` and -- if targeting
the ``local`` location -- regarding the disk space still available locally in the system.
By default only returns the files and folders in the root directory. If the query parameter ``recursive``
is provided and set to ``true``, returns all files and folders.
Returns a :ref:`Retrieve response <sec-api-fileops-datamodel-retrieveresponse>`.
**Example**:
.. sourcecode:: http
GET /api/files/local HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files": [
{
"name": "whistle_v2.gcode",
"path": "whistle_v2.gcode",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"hash": "...",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
}
],
"free": "3.2GB"
}
:param location: The origin location from which to retrieve the files. Currently only ``local`` and ``sdcard`` are
supported, with ``local`` referring to files stored in OctoPrint's ``uploads`` folder and ``sdcard``
referring to files stored on the printer's SD card (if available).
:param recursive: If set to ``true``, return all files and folders recursively. Otherwise only return items on same level.
:statuscode 200: No error
:statuscode 404: If `location` is neither ``local`` nor ``sdcard``
.. _sec-api-fileops-uploadfile:
Upload file or create folder
============================
.. http:post:: /api/files/(string:location)
Upload a file to the selected ``location`` or create a new empty folder on it.
Other than most of the other requests on OctoPrint's API which are expected as JSON, this request is expected as
``Content-Type: multipart/form-data`` due to the included file upload.
To upload a file, the request body must at least contain the ``file`` form field with the
contents and file name of the file to upload.
To create a new folder, the request body must at least contain the ``foldername`` form field,
specifying the name of the new folder. Note that folder creation is currently only supported on
the ``local`` file system.
Returns a :http:statuscode:`201` response with a ``Location`` header set to the management URL of the uploaded
file and an :ref:`Upload Response <sec-api-fileops-datamodel-uploadresponse>` as the body upon successful completion.
Requires user rights.
**Example for uploading a file**
.. sourcecode:: http
POST /api/files/sdcard HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryDeC2E3iWbTv1PwMC
------WebKitFormBoundaryDeC2E3iWbTv1PwMC
Content-Disposition: form-data; name="file"; filename="whistle_v2.gcode"
Content-Type: application/octet-stream
M109 T0 S220.000000
T0
G21
G90
...
------WebKitFormBoundaryDeC2E3iWbTv1PwMC
Content-Disposition: form-data; name="select"
true
------WebKitFormBoundaryDeC2E3iWbTv1PwMC
Content-Disposition: form-data; name="print"
true
------WebKitFormBoundaryDeC2E3iWbTv1PwMC--
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
Location: http://example.com/api/files/sdcard/whistle_v2.gcode
{
"files": {
"local": {
"name": "whistle_v2.gcode",
"path": "whistle_v2.gcode",
"type": "machinecode",
"typePath": ["machinecode", "gcode"],
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
}
},
"sdcard": {
"name": "whistle_.gco",
"path": "whistle_.gco",
"origin": "sdcard",
"refs": {
"resource": "http://example.com/api/files/sdcard/whistle_.gco"
}
}
},
"done": false
}
**Example with UTF-8 encoded filename following RFC 5987**
.. sourcecode:: http
POST /api/files/local HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryDeC2E3iWbTv1PwMC
------WebKitFormBoundaryDeC2E3iWbTv1PwMC
Content-Disposition: form-data; name="file"; filename*=utf-8''20mm-%C3%BCml%C3%A4ut-b%C3%B6x.gcode
Content-Type: application/octet-stream
M109 T0 S220.000000
T0
G21
G90
...
------WebKitFormBoundaryDeC2E3iWbTv1PwMC--
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
Location: http://example.com/api/files/local/20mm-umlaut-box.gcode
{
"files": {
"local": {
"name": "20mm-umlaut-box",
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
}
}
},
"done": true
}
**Example for creating a folder**
.. sourcecode:: http
POST /api/files/local HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryDeC2E3iWbTv1PwMD
------WebKitFormBoundaryDeC2E3iWbTv1PwMD
Content-Disposition: form-data; name="foldername"
subfolder
------WebKitFormBoundaryDeC2E3iWbTv1PwMD
Content-Disposition: form-data; name="path"
folder/
------WebKitFormBoundaryDeC2E3iWbTv1PwMD--
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
Location: http://example.com/api/files/local/folder/subfolder
{
"folder": {
"name": "subfolder",
"path": "folder/subfolder",
"origin": "local"
},
"done": true
}
:param location: The target location to which to upload the file. Currently only ``local`` and ``sdcard`` are supported
here, with ``local`` referring to OctoPrint's ``uploads`` folder and ``sdcard`` referring to
the printer's SD card. If an upload targets the SD card, it will also be stored locally first.
:form file: The file to upload, including a valid ``filename``.
:form path: The path within the ``location`` to upload the file to or create the folder in (without the future
filename or ``foldername`` - basically the parent folder). If unset will be taken from the provided
``file``'s name or ``foldername`` and default to the root folder of the ``location``.
:form select: Whether to select the file directly after upload (``true``) or not (``false``). Optional, defaults
to ``false``. Ignored when creating a folder.
:form print: Whether to start printing the file directly after upload (``true``) or not (``false``). If set, ``select``
is implicitly ``true`` as well. Optional, defaults to ``false``. Ignored when creating a folder.
:form userdata: [Optional] An optional string that if specified will be interpreted as JSON and then saved along
with the file as metadata (metadata key ``userdata``). Ignored when creating a folder.
:form foldername: The name of the folder to create. Ignored when uploading a file.
:statuscode 201: No error
:statuscode 400: If no ``file`` or ``foldername`` are included in the request, ``userdata`` was provided but could
not be parsed as JSON or the request is otherwise invalid.
:statuscode 404: If ``location`` is neither ``local`` nor ``sdcard`` or trying to upload to SD card and SD card support
is disabled
:statuscode 409: If the upload of the file would override the file that is currently being printed or if an upload
to SD card was requested and the printer is either not operational or currently busy with a print job.
:statuscode 415: If the file is neither a ``gcode`` nor an ``stl`` file (or it is an ``stl`` file but slicing support
is disabled)
:statuscode 500: If the upload failed internally
.. _sec-api-fileops-retrievefileinfo:
Retrieve a specific file's or folder's information
==================================================
.. http:get:: /api/files/(string:location)/(path:filename)
Retrieves the selected file's or folder's information.
If the file is unknown, a :http:statuscode:`404` is returned.
If the targeted path is a folder, by default only its direct children will be returned. If ``recursive`` is
provided and set to ``true``, all sub folders and their children will be returned too.
On success, a :http:statuscode:`200` is returned, with a :ref:`file information item <sec-api-datamodel-files-file>`
as the response body.
**Example**
.. sourcecode:: http
GET /api/files/local/whistle_v2.gcode HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "whistle_v2.gcode",
"size": 1468987,
"date": 1378847754,
"origin": "local",
"refs": {
"resource": "http://example.com/api/files/local/whistle_v2.gcode",
"download": "http://example.com/downloads/files/local/whistle_v2.gcode"
},
"gcodeAnalysis": {
"estimatedPrintTime": 1188,
"filament": {
"length": 810,
"volume": 5.36
}
},
"print": {
"failure": 4,
"success": 23,
"last": {
"date": 1387144346,
"success": true
}
}
}
:param location: The location of the file for which to retrieve the information, either ``local`` or ``sdcard``.
:param filename: The filename of the file for which to retrieve the information
:param recursive: If set to ``true``, return all files and folders recursively. Otherwise only return items on same level.
:statuscode 200: No error
:statuscode 404: If ``target`` is neither ``local`` nor ``sdcard``, ``sdcard`` but SD card support is disabled or the
requested file was not found
.. _sec-api-fileops-filecommand:
Issue a file command
====================
.. http:post:: /api/files/(string:location)/(path:path)
Issue a file command to an existing file. Currently supported commands are:
select
Selects a file for printing. Additional parameters are:
* ``print``: Optional, if set to ``true`` the file will start printing directly after selection. If the printer
is not operational when this parameter is present and set to ``true``, the request will fail with a response
of ``409 Conflict``.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
slice
Slices an STL file into GCODE. Note that this is an asynchronous operation that will take place in the background
after the response has been sent back to the client. Additional parameters are:
* ``slicer``: The slicing engine to use, defaults to ``cura`` if not set, which is also the only supported slicer right now.
* ``gcode``: Name of the GCODE file to generated, in the same location as the STL file. Defaults to the STL file name
with extension ``.gco`` if not set.
* ``position``: Position of the object-to-slice's center on the print bed. A dictionary containing both ``x`` and ``y``
coordinate in mm is expected
* ``printerProfile``: Name of the printer profile to use, if not set the default printer profile will be used.
* ``profile``: Name of the slicing profile to use, if not set the default slicing profile of the slicer will be used.
* ``profile.*``: Override parameters, the ``profile.`` prefix will be stripped and the matching profile key will
be overridden with the supplied value. Use this if you want to specify things that change often like a different
temperature, filament diameter or infill percentage. Profile keys are slicer specific.
* ``select``: Optional, if set to ``true`` the file be selected for printing right after the slicing has finished. If the
printer is not operational or already printing when this parameter is present and set to ``true``, the request will
fail with a response of ``409 Conflict``
* ``print``: Optional, if set to ``true`` the file be selected and start printing right after the slicing has finished.
If the printer is not operational or already printing when this parameter is present and set to ``true``, the request
will fail with a response of ``409 Conflict``. Note that if this parameter is set, the parameter ``select`` does not
need to be set, it is automatically assumed to be ``true`` too, otherwise no printing would be possible.
If consecutive slicing calls are made targeting the same GCODE filename (that also holds true if the default is used),
the slicing job already running in the background will be cancelled before the new one is started. Note that this will
also mean that if it was supposed to be directly selected and start printing after the slicing finished, this will not
take place anymore and whether this will happen with the new sliced file depends entirely on the new request!
Upon success, a status code of :http:statuscode:`202` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
body will be returned.
copy
Copies the file or folder to a new ``destination`` on the same ``location``. Additional parameters are:
* ``destination``: The path of the parent folder to which to copy the file or folder. It must already exist.
If there already exists a file or folder of the same name at ``destination``, the request will return a :http:statuscode:`409`.
If the ``destination`` folder does not exist, a :http:statuscode:`404` will be returned.
Upon success, a status code of :http:statuscode:`201` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
body will be returned.
move
Moves the file or folder to a new ``destination`` on the same ``location``. Additional parameters are:
* ``destination``: The path of the parent folder to which to move the file or folder.
If there already exists a file or folder of the same name at ``destination``, the request will return a :http:statuscode:`409`.
If the ``destination`` folder does not exist, a :http:statuscode:`404` will be returned. If the ``path`` is currently
in use by OctoPrint (e.g. it is a GCODE file that's currently being printed) a :http:statuscode:`409` will be
returned.
Upon success, a status code of :http:statuscode:`201` and a :ref:`sec-api-datamodel-files-fileabridged` in the response
body will be returned.
Requires user rights.
**Example Select Request**
.. sourcecode:: http
POST /api/files/local/whistle_v2.gcode HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "select",
"print": true
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Slice Request**
.. sourcecode:: http
POST /api/files/local/some_folder/some_model.stl HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "slice",
"slicer": "cura",
"gcode": "some_model.first_try.gcode",
"printerProfile": "my_custom_reprap",
"profile": "high_quality",
"profile.infill": 75,
"profile.fill_density": 15,
"position": {"x": 100, "y": 100},
"print": true
}
.. sourcecode:: http
HTTP/1.1 202 Accepted
Content-Type: application/json
{
"origin": "local",
"name": "some_model.first_try.gcode",
"path": "some_folder/some_model.first_try.gcode",
"refs": {
"download": "http://example.com/downloads/files/local/some_folder/some_model.first_try.gcode",
"resource": "http://example.com/api/files/local/some_folder/some_model.first_try.gcode"
}
}
**Example Copy Request**
.. sourcecode:: http
POST /api/files/local/some_folder/some_model.gcode HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "copy",
"destination": "some_other_folder/subfolder"
}
.. sourcecode:: http
HTTP/1.1 201 Created
Content-Type: application/json
{
"origin": "local",
"name": "some_model.gcode",
"path": "some_other_folder/subfolder/some_model.gcode",
"refs": {
"download": "http://example.com/downloads/files/local/some_other_folder/subfolder/some_model.gcode",
"resource": "http://example.com/api/files/local/some_other_folder/subfolder/some_model.gcode"
}
}
**Example Move Request**
.. sourcecode:: http
POST /api/files/local/some_folder/and_a_subfolder HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "move",
"destination": "some_other_folder"
}
.. sourcecode:: http
HTTP/1.1 201 Created
Content-Type: application/json
{
"origin": "local",
"name": "and_a_subfolder",
"path": "some_other_folder/and_a_subfolder",
"refs": {
"resource": "http://example.com/api/files/local/some_other_folder/and_a_subfolder"
}
}
:param location: The target location on which to send the command for is located, either ``local`` (for OctoPrint's ``uploads``
folder) or ``sdcard`` for the printer's SD card (if available)
:param path: The path of the file for which to issue the command
:json string command: The command to issue for the file, currently only ``select`` is supported
:json boolean print: ``select`` and ``slice`` command: Optional, whether to start printing the file directly after selection
or slicing, defaults to ``false``.
:json string slicer: ``slice`` command: The slicer to use, defaults to the default slicer.
:json string gcode: ``slice`` command: The name of the gcode file to create, defaults to the targeted stl's file name
with its extension changed to ``.gco`` (e.g. "test.stl" will be sliced to "test.gco" if not specified
otherwise)
:json string profile: ``slice`` command: The slicing profile to use, defaults to the selected slicer's default profile.
:json string profile.*: ``slice`` command: Overrides for the selected slicing profile, e.g. to specify a different temperature
or filament diameter.
:json string printerProfile: ``slice`` command: The printer profile to use, defaults to the default printer profile.
:json boolean select: ``slice`` command: Optional, whether to select the file for printing directly after slicing,
defaults to ``false``
:statuscode 200: No error for a ``select`` command.
:statuscode 202: No error for a ``slice`` command.
:statuscode 400: If the ``command`` is unknown or the request is otherwise invalid
:statuscode 415: If a ``slice`` command was issued against something other than an STL file.
:statuscode 404: If ``location`` is neither ``local`` nor ``sdcard`` or the requested file was not found
:statuscode 409: If a selected file is supposed to start printing directly but the printer is not operational or
if a file to be sliced is supposed to be selected or start printing directly but the printer
is not operational or already printing.
.. _sec-api-fileops-delete:
Delete file
===========
.. http:delete:: /api/files/(string:location)/(path:path)
Delete the selected ``path`` on the selected ``location``.
If the file to be deleted is currently being printed, a :http:statuscode:`409` will be returned.
Returns a :http:statuscode:`204` after successful deletion.
Requires user rights.
**Example Request**
.. sourcecode:: http
DELETE /api/files/local/whistle_v2.gcode HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
:param location: The target location on which to delete the file, either ``local`` (for OctoPrint's ``uploads``
folder) or ``sdcard`` for the printer's SD card (if available)
:param path: The path of the file to delete
:statuscode 204: No error
:statuscode 404: If ``location`` is neither ``local`` nor ``sdcard`` or the requested file was not found
:statuscode 409: If the file to be deleted is currently being printed
.. _sec-api-fileops-datamodel:
Data model
==========
.. _sec-api-fileops-datamodel-retrieveresponse:
Retrieve response
-----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``files``
- 0..*
- Array of :ref:`File information items <sec-api-datamodel-files-file>`
- The list of requested files. Might be an empty list if no files are available
* - ``free``
- 0..1
- String
- The amount of disk space in bytes available in the local disk space (refers to OctoPrint's ``uploads`` folder). Only
returned if file list was requested for origin ``local`` or all origins.
.. _sec-api-fileops-datamodel-uploadresponse:
Upload response
---------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``files``
- 0..1
- Object
- Abridged information regarding the file that was just uploaded. If only uploaded to ``local`` this will only
contain the ``local`` property. If uploaded to SD card, this will contain both ``local`` and ``sdcard`` properties.
Only contained if a file was uploaded, not present if only a new folder was created.
* - ``files.local``
- 1
- :ref:`sec-api-datamodel-files-fileabridged`
- The information regarding the file that was just uploaded to the local storage.
* - ``files.sdcard``
- 0..1
- :ref:`sec-api-datamodel-files-fileabridged`
- The information regarding the file that was just uploaded to the printer's SD card.
* - ``folder``
- 0..1
- :ref:`sec-api-datamodel-files-fileabridged`
- Abridged information regarding the folder that was just created. Only contained if a folder
was created, not present if a file was uploaded.
* - ``done``
- 1
- Boolean
- Whether any file processing after upload has already finished (``true``) or not, e.g. due to first needing
to perform a slicing step (``false``). Clients may use this information to direct progress displays related to
the upload.
+12 -129
View File
@@ -11,12 +11,9 @@ General information
Authorization
=============
If :ref:`Access Control <sec-features-access_control>` is enabled OctoPrint's API expects an API key to be supplied with each request. This API
key can be either the globally configured one, a user specific one or an app and user specific one as generated by the
authorization workflow implemented by the bundled :ref:`Application Keys Plugin <sec-bundledplugins-appkeys>` (since 1.3.10).
Clients are advised to implement the :ref:`Application Keys Plugin workflow <sec-bundledplugins-appkeys-workflow>` first and
fallback on directing the user to manually supply the the user specific API key. The global key should rarely be used.
OctoPrint's API expects an API key to be supplied with each request. This API key can be either the globally
configured one, a user specific one if "Access Control" is enabled or an ref:`App Session Key <sec-api-apps-sessionkey>`.
Users are able to generate and revoke their custom API key via the "Change password" dialog.
The API key must be supplied in the custom HTTP header ``X-Api-Key``, e.g.
@@ -26,6 +23,8 @@ The API key must be supplied in the custom HTTP header ``X-Api-Key``, e.g.
Host: example.com
X-Api-Key: abcdef...
If it is missing or included but invalid, OctoPrint will directly return a response with status :http:statuscode:`401`.
For testing purposes it is also possible to supply the API key via a query parameter ``apikey``, e.g.
.. sourcecode:: http
@@ -35,24 +34,6 @@ For testing purposes it is also possible to supply the API key via a query param
Please be advised that clients should use the header field variant if at all possible.
If the key is missing or invalid, OctoPrint will treat the request as it would any unauthenticated anonymous request to the endpoint.
Consequently, if the bundled :ref:`ForceLogin plugin <sec-bundledplugins-forcelogin>` is active (which is the default), that means
that any requests without or with an invalid API key targeting other API endpoints than :ref:`Login <sec-api-general-login>`
will be denied with a :http:statuscode:`403`.
.. warning::
If :ref:`Access Control <sec-features-access_control>` is disabled, OctoPrint will treat any unauthenticated anonymous requests and thus also requests
with an invalid or outright missing API key as requests with full admin rights!
.. note::
The API key requirements changed in 1.3.11. Up to that version, even if Access Control was disabled, all requests needed to
be supplied with an API Key. To make the webinterface work under these circumstances, an unauthenticated anonymous API key was injected into the
HTML page and also available on the :ref:`Push API <sec-api-push>`. The presence and ready availability of this unauthenticated
anonymous "UI API key" caused confusion and false alarm among users and didn't contribute to the security of the platform in a
meaningful way, so it was finally abandoned in 1.3.11.
.. _fig-api-general-globalapikey:
.. figure:: ../images/settings-global-api-key.png
:align: center
@@ -74,12 +55,17 @@ will be denied with a :http:statuscode:`403`.
The API key options in the "Change password" dialog. Users can generate and revoke their custom API key here.
.. note::
OctoPrint's web interface uses a custom API key that is freshly generated on every server start. This key is not
intended to be used by any other client and would not be very useful in any case, since it basically represents
a completely anonymous client.
.. _sec-api-general-contenttype:
Content Type
============
If not otherwise stated, OctoPrint's API expects request bodies and issues response bodies as ``Content-Type: application/json``.
If not otherwise stated OctoPrint's API expects request bodies and issues response bodies as ``Content-Type: application/json``.
.. _sec-api-general-encoding:
@@ -88,19 +74,7 @@ Encoding
OctoPrint uses UTF-8 as charset.
That also includes headers in ``multipart/form-data`` requests, in order to allow the full UTF-8 range of characters
for uploaded filenames. If a ``multipart/form-data`` sub header cannot be decoded as UTF-8, OctoPrint will also attempt
to decode it as ISO-8859-1.
Additionally, OctoPrint supports replacing the ``filename`` field in the ``Content-Disposition`` header of a
multipart field with a ``filename*`` field following `RFC 5987, Section 3.2 <https://tools.ietf.org/html/rfc5987#section-3.2>`_,
which allows defining the charset used for encoding the filename. If both ``filename`` and ``filename*`` fields are
present, following the recommendation of the RFC ``filename*`` will be used.
For an example on how to send a request utilizing RFC 5987 for the ``filename*`` attribute, see the second example
in :ref:`Upload file <sec-api-fileops-uploadfile>`.
.. _sec-api-general-crossorigin:
.. _sec-api-cross-origin:
Cross-origin requests
=====================
@@ -134,94 +108,3 @@ If CORS is not enabled you will get errors like the following::
XMLHttpRequest cannot load http://localhost:8081/api/files. No 'Access-Control-Allow-Origin'
header is present on the requested resource.
.. _sec-api-general-login:
Login
=====
.. http:post:: /api/login
Creates a login session or retrieves information about the currently existing session ("passive login").
Can be used in one of two ways: to login a user via username and password and create a persistent session (usually
from a UI in the browser), or to retrieve information about the active user (from an existing session or an API key)
via the ``passive`` flag.
Will return a :http:statuscode:`200` with a :ref:`login response <sec-api-general-datamodel-login>` on successful
login, whether active or passive. The active (username/password) login may also return a :http:statuscode:`401` in
case of a username/password mismatch or unknown user and a :http:statuscode:`403` in case of a deactivated account.
:json passive: If present, performs a passive login only, returning information about the current user that's
active either through an existing session or the used API key
:json user: (active login only) Username
:json pass: (active login only) Password
:json remember: (active login only) Whether to set a "remember me" cookie on the session
:status 200: Successful login
:status 401: Username/password mismatch or unknown user
:status 403: Deactivated account
.. _sec-api-general-logout:
Logout
======
.. http:post:: /api/logout
Ends the current login session of the current user.
Only makes sense in the context of browser based workflows.
Will return a :http:statuscode:`204`.
:status 204: No error
.. _sec-api-general-datamodel:
Data model
==========
.. _sec-api-general-datamodel-login:
Login response
--------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- the user's name/id
* - ``active``
- 1
- boolean
- Whether the user's account is active or not
* - ``admin``
- 1
- boolean
- Whether the user has admin rights or not
* - ``user``
- 1
- boolean
- Whether the user has user rights or not (always ``true``)
* - ``apikey``
- 1
- string or None
- The user's API key, if set
* - ``settings``
- 1
- dict
- The user's settings, if any
* - ``session``
- 1
- string
- The session key, can be used to authenticate with the ``auth`` message on the :ref:`push API <sec-api-push>`.
* - ``_is_external_client``
- 1
- boolean
- Whether the client that made the request got detected as external from the local network or not.
+6 -13
View File
@@ -1,8 +1,8 @@
.. _sec-api:
########
REST API
########
#################
API Documentation
#################
.. toctree::
:maxdepth: 2
@@ -10,19 +10,12 @@ REST API
general.rst
version.rst
apps.rst
fileops.rst
connection.rst
files.rst
job.rst
languages.rst
logs.rst
printer.rst
printerprofiles.rst
settings.rst
job.rst
logs.rst
slicing.rst
system.rst
timelapse.rst
users.rst
util.rst
wizard.rst
push.rst
datamodel.rst
+16 -84
View File
@@ -4,9 +4,6 @@
Job operations
**************
Use these operations to query the currently selected file and start/cancel/restart/pause the
actual print job.
.. contents::
.. _sec-api-jobs-command:
@@ -22,48 +19,25 @@ Issue a job command
Starts the print of the currently selected file. For selecting a file, see :ref:`Issue a file command <sec-api-fileops-filecommand>`.
If a print job is already active, a :http:statuscode:`409` will be returned.
cancel
Cancels the current print job. If no print job is active (either paused or printing), a :http:statuscode:`409`
will be returned.
restart
Restart the print of the currently selected file from the beginning. There must be an active print job for this to work
and the print job must currently be paused. If either is not the case, a :http:statuscode:`409` will be returned.
Equivalent to issuing a ``cancel`` command while paused, directly followed by a ``start`` command.
pause
Pauses/resumes/toggles the current print job. Accepts one optional additional parameter ``action``
specifying which action to take. Valid values for this parameter are:
Pauses/unpauses the current print job. If no print job is active (either paused or printing), a :http:statuscode:`409`
will be returned.
pause
Pauses the current job if it's printing, does nothing if it's already paused.
resume
Resumes the current job if it's paused, does nothing if it's printing.
toggle
Toggles the pause state of the job, pausing it if it's printing and resuming it if it's currently paused.
In order to stay backwards compatible to earlier iterations of this API, the default
action to take if no ``action`` parameter is supplied is to toggle the print job status.
If no print job is active (either paused or printing), a :http:statuscode:`409` will be returned.
.. note::
While the approach to implement pause/resume/toggle behaviour through sub commands via the ``action``
parameter instead of having dedicated ``pause``, ``resume`` and ``toggle`` commands seems clumsy, this path
was chosen to have the API stay backwards compatible to prior versions which only offered the toggle
behaviour under the ``pause`` command.
cancel
Cancels the current print job. If no print job is active (either paused or printing), a :http:statuscode:`409`
will be returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example Start Request**
.. sourcecode:: http
POST /api/job HTTP/1.1
POST /api/control/job HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
@@ -76,28 +50,11 @@ Issue a job command
HTTP/1.1 204 No Content
**Example Cancel Request**
.. sourcecode:: http
POST /api/job HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "cancel"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Restart Request**
.. sourcecode:: http
POST /api/job HTTP/1.1
POST /api/control/job HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
@@ -114,50 +71,30 @@ Issue a job command
.. sourcecode:: http
POST /api/job HTTP/1.1
POST /api/control/job HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "pause",
"action": "pause"
"command": "pause"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Resume Request**
**Example Cancel Request**
.. sourcecode:: http
POST /api/job HTTP/1.1
POST /api/control/job HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "pause",
"action": "resume"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Pause Toggle Request**
.. sourcecode:: http
POST /api/job HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "pause",
"action": "toggle"
"command": "cancel"
}
.. sourcecode:: http
@@ -212,16 +149,15 @@ Retrieve information about the current job
"filepos": 337942,
"printTime": 276,
"printTimeLeft": 912
},
"state": "Printing"
}
}
:statuscode 200: No error
.. _sec-api-job-datamodel:
Data model
==========
Datamodel
=========
.. _sec-api-job-datamodel-response:
@@ -244,8 +180,4 @@ Job information response
- 1
- :ref:`sec-api-datamodel-jobs-progress`
- Information regarding the progress of the current print job
* - ``state``
- 1
- String
- A textual representation of the current state of the job, i.e. "Operational", "Printing", "Pausing", "Paused",
"Cancelling", "Error" or "Offline".
-226
View File
@@ -1,226 +0,0 @@
.. _sec-api-languages:
*********
Languages
*********
.. note::
All language pack management operations require admin rights.
.. contents::
.. _sec-api-languages-list:
Retrieve installed language packs
=================================
.. http:get:: /api/languages
Retrieves a list of installed language packs.
The response body will contain a :ref:`list response <sec-api-languages-datamodel-listresponse>`.
**Example**
.. sourcecode:: http
GET /api/languages HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"language_packs": {
"_core": {
"identifier": "_core",
"name": "Core",
"languages": []
},
"some_plugin": {
"identifier": "some_plugin",
"name": "Some Plugin",
"languages": [
{
"locale": "de",
"locale_display": "Deutsch",
"locale_english": "German",
"last_update": 1474574597,
"author": "Gina Häußge"
},
{
"locale": "it",
"locale_display": "Italiano",
"locale_english": "Italian",
"last_update": 1470859680,
"author": "The italian Transifex Team"
}
]
}
}
:statuscode 200: No error
.. _sec-api-languages-upload:
Upload a language pack
======================
.. http:post:: /api/languages
Uploads a new language pack to OctoPrint.
Other than most of the other requests on OctoPrint's API which are expected as JSON, this request is expected as
``Content-Type: multipart/form-data`` due to the included file upload.
To upload a file, the request body must contain the ``file`` form field with the
contents and file name of the file to upload.
Only files with one of the extensions ``zip``, ``tar.gz``, ``tgz`` or ``tar`` will be
processed, for other file extensions a :http:statuscode:`400` will be returned.
Will return a list of installed language packs upon completion, as described in
:ref:`Retrieve installed language packs <sec-api-languages-list>`.
:form file: The language pack file to upload
:statuscode 200: The file was uploaded successfully
.. _sec-api-languages-delete:
Delete a language pack
======================
.. http:delete:: /api/languages/(string:locale)/(string:pack)
Deletes the language pack ``pack`` for locale ``locale``. Can be either
the ``_core`` pack (containing translations for core OctoPrint) or
the language pack for a plugin specified by the plugin identifier.
Returns a list of installed language packs, as described in
:ref:`Retrieve installed language packs <sec-api-languages-list>`.
**Example**
.. sourcecode:: http
DELETE /api/languages/it/some_plugin HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"language_packs": {
"_core": {
"identifier": "_core",
"name": "Core",
"languages": []
},
"some_plugin": {
"identifier": "some_plugin",
"name": "Some Plugin",
"languages": [
{
"locale": "de",
"locale_display": "Deutsch",
"locale_english": "German",
"last_update": 1474574597,
"author": "Gina Häußge"
}
]
}
}
:param locale: The locale for which to delete the language pack
:param pack: The language pack to delete
:statuscode 200: The language pack was deleted
.. _sec-api-languages-datamodel:
Data model
==========
.. _sec-api-languages-datamodel-listresponse:
List response
-------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``language_packs``
- 0..*
- Map of :ref:`component lists <sec-api-languages-datamodel-componentlist>`
- Map of component lists, indexed by the component's identifier
.. _sec-api-languages-datamodel-componentlist:
Component list
--------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``identifier``
- 1
- string
- The plugin's identifier, ``_core`` for core OctoPrint, the plugin's identifier for plugins
* - ``display``
- 1
- string
- Displayable name of the component, ``Core`` for core OctoPrint, the plugin's name for plugins
* - ``languages``
- 0..*
- List of :ref:`language pack meta data <sec-api-languages-datamodel-packmeta>`
- Language packs for the component
.. _sec-api-languages-datamodel-packmeta:
Language pack metadata
----------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``locale``
- 1
- string
- Locale of the language pack
* - ``locale_display``
- 1
- string
- Displayable name of the locale
* - ``locale_english``
- 1
- string
- English representation of the locale
* - ``last_update``
- 0..1
- int
- Timestamp of the last update of the language pack
* - ``author``
- 0..1
- string
- Author of the language pack
+168 -5
View File
@@ -4,9 +4,172 @@
Log file management
*******************
Log file management (and logging configuration) was moved into a bundled plugin in OctoPrint 1.3.7. Refer to
:ref:`the Logging's plugins API <sec-bundledplugins-logging-api>` for the API documentation.
.. note::
The former endpoints ``/api/logs`` and ``api/logs/<path>`` are marked as deprecated but still work for now. New
client implementations should directly use the new endpoints provided by the bundled plugin. Existing implementations
should adapt their endpoints as soon as possible.
All log file management operations require admin rights.
.. contents::
.. _sec-api-logs-list:
Retrieve a list of available log files
======================================
.. http:post:: /api/logs
Retrieve information regarding all log files currently available and regarding the disk space still available
in the system on the location the log files are being stored.
Returns a :ref:`Logfile Retrieve response <sec-api-logs-datamodel-retrieveresponse>`.
**Example**
.. sourcecode:: http
GET /api/logs HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files" : [
{
"date" : 1393158814,
"name" : "octoprint.log",
"size" : 43712,
"refs": {
"resource": "http://example.com/api/logs/octoprint.log",
"download": "http://example.com/downloads/logs/octoprint.log"
}
},
{
"date" : 1392628936,
"name" : "octoprint.log.2014-02-17",
"size" : 13205,
"refs": {
"resource": "http://example.com/api/logs/octoprint.log.2014-02-17",
"download": "http://example.com/downloads/logs/octoprint.log.2014-02-17"
}
},
{
"date" : 1393158814,
"name" : "serial.log",
"size" : 1798419,
"refs": {
"resource": "http://example.com/api/logs/serial.log",
"download": "http://example.com/downloads/logs/serial.log"
}
}
],
"free": 12237201408
}
:statuscode 200: No error
:statuscode 403: If the given API token did not have admin rights associated with it
.. _sec-api-logs-delete:
Delete a specific logfile
=========================
.. http:delete:: /api/logs/(path:filename)
Delete the selected log file with name `filename`.
Returns a :http:statuscode:`204` after successful deletion.
**Example Request**
.. sourcecode:: http
DELETE /api/logs/octoprint.log.2014-02-17 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
:param filename: The filename of the log file to delete
:statuscode 204: No error
:statuscode 403: If the given API token did not have admin rights associated with it
:statuscode 404: If the file was not found
.. _sec-api-logs-datamodel:
Datamodel
=========
.. _sec-api-logs-datamodel-retrieveresponse:
Logfile Retrieve Response
-------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``files``
- 0..*
- Array of :ref:`File information items <sec-api-logs-datamodel-fileinfo>`
- The list of requested files. Might be an empty list if no files are available
* - ``free``
- 1
- String
- The amount of disk space in bytes available in the local disk space (refers to OctoPrint's ``logs`` folder).
.. _sec-api-logs-datamodel-fileinfo:
File information
----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- String
- The name of the file
* - ``size``
- 1
- Number
- The size of the file in bytes.
* - ``date``
- 1
- Unix timestamp
- The timestamp when this file was last modified.
* - ``refs``
- 1
- :ref:`sec-api-logs-datamodel-ref`
- References relevant to this file
.. _sec-api-logs-datamodel-ref:
References
----------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``resource``
- 1
- URL
- The resource that represents the file (e.g. for deleting)
* - ``download``
- 1
- URL
- The download URL for the file
+25 -405
View File
@@ -4,6 +4,12 @@
Printer operations
******************
.. warning::
This part of the API is still heavily in development, especially anything that has to do with temperature control.
If you happen to want to develop against it, you should drop me an email to make sure I can give you a heads-up when
something changes.
.. contents::
Printer control is mostly achieved through the use of commands, issued to resources reflecting components of the
@@ -19,14 +25,8 @@ Tool
See :ref:`sec-api-printer-toolcommand`.
Bed
Bed commands allow setting the temperature and temperature offset for the printer's heated bed. Querying the
corresponding resource returns temperature information including an optional history. Note that Bed commands
are only available if the currently selected printer profile has a heated bed.
corresponding resource returns temperature information including an optional history.
See :ref:`sec-api-printer-bedcommand`.
Chamber
Chamber commands allow setting the temperature and temperature offset for the printer's heated chamber. Querying
the corresponding resource returns temperature information including an option history. Note that Chamber commands
are only available if the currently selected printer profile has a heated chamber.
See :ref:`sec-api-printer-chambercommand`.
SD card
SD commands allow initialization, refresh and release of the printer's SD card (if available). Querying the
corresponding resource returns the current SD card state.
@@ -34,29 +34,6 @@ SD card
Besides that, OctoPrint also provides a :ref:`full state report of the printer <sec-api-printer-state>`.
.. note::
You might be wondering why all command responses below only return a ``204`` with an empty body instead of
the output of the just sent commands. There are two reasons for this.
OctoPrint's internal webserver is single threaded and can only handle one request at a time. This is
not a problem generally since asynchronous programming allows to just have one request which is waiting for
data from a long running backend operation to sleep while handling other requests. The internal framework
used for providing the REST API though, Flask, is based on WSGI, which is synchronous in nature. This means
that it is impossible to wait in a non blocking wait while handling a request on the REST API. So in order to
return the response of a command sent to the printer, the single thread of the webserver would have to be blocked
by the API while the response wasn't available yet. Which in turn would mean that the whole web server would
stop responding while waiting for the printer to reply, which, depending on the command in question (e.g. homing)
can take a long while. That would be a bad idea.
The second reason is that thanks to a large number of firmwares out there having a `particular bug <https://github.com/MarlinFirmware/Marlin/commit/acc0e7527914948656ccabba35f7faedc94ef885>`_
that makes it impossible to track the output of sent commands, identifying the correct response to a given
sent command is pretty much hit-and-miss. That situation gets even worse considering that it's next to impossible
to distinguish firmware versions which have that bug from firmware versions which don't have it.
Hence OctoPrint currently doesn't offer any synchronous way of retrieving the output of responses from the printer.
If you need the printer's serial communication, you'll need to subscribe to :ref:`push updates <sec-api-push>`.
.. _sec-api-printer-state:
Retrieve the current printer state
@@ -154,8 +131,6 @@ Retrieve the current printer state
"operational": true,
"paused": false,
"printing": false,
"cancelling": false,
"pausing": false,
"sdReady": true,
"error": false,
"ready": true,
@@ -186,8 +161,6 @@ Retrieve the current printer state
"operational": true,
"paused": false,
"printing": false,
"cancelling": false,
"pausing": false,
"sdReady": true,
"error": false,
"ready": true,
@@ -217,32 +190,20 @@ Issue a print head command
jog
Jogs the print head (relatively) by a defined amount in one or more axes. Additional parameters are:
* ``x``: Optional. Amount/coordinate to jog print head on x axis, must be a valid number corresponding to the distance to travel in mm.
* ``y``: Optional. Amount/coordinate to jog print head on y axis, must be a valid number corresponding to the distance to travel in mm.
* ``z``: Optional. Amount/coordinate to jog print head on z axis, must be a valid number corresponding to the distance to travel in mm.
* ``absolute``: Optional. Boolean value specifying whether to move relative to current position (provided
axes values are relative amounts) or to absolute position (provided axes values are coordinates)
* ``speed``: Optional. Speed at which to move. If not provided, minimum speed for all selected axes from printer
profile will be used. If provided but ``false``, no speed parameter will be appended to the command. Otherwise
interpreted as an integer signifying the speed in mm/min, to append to the command.
* ``x``: Optional. Amount to jog print head on x axis, must be a valid number corresponding to the distance to travel in mm.
* ``y``: Optional. Amount to jog print head on y axis, must be a valid number corresponding to the distance to travel in mm.
* ``z``: Optional. Amount to jog print head on z axis, must be a valid number corresponding to the distance to travel in mm.
home
Homes the print head in all of the given axes. Additional parameters are:
* ``axes``: A list of axes which to home, valid values are one or more of ``x``, ``y``, ``z``.
feedrate
Changes the feedrate factor to apply to the movements of the axes.
* ``factor``: The new factor, percentage between 50 and 200% as integer (``50`` to ``200``) or float (``0.5`` to ``2.0``).
All of these commands except ``feedrate`` may only be sent if the printer is currently operational and not printing.
Otherwise a :http:statuscode:`409` is returned.
All of these commands may only be sent if the printer is currently operational and not printing. Otherwise a
:http:statuscode:`409` is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example Jog Request**
Jog the print head by 10mm in X, -5mm in Y and 0.02mm in Z.
@@ -285,54 +246,13 @@ Issue a print head command
HTTP/1.1 204 No Content
**Example feed rate request (1/2)**
Set the feed rate factor to 105% using an integer argument.
.. sourcecode:: http
POST /api/printer/printhead HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "feedrate",
"factor": 105
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example feed rate request (2/2)**
Set the feed rate factor to 105% using a float argument.
.. sourcecode:: http
POST /api/printer/printhead HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "feedrate",
"factor": 1.05
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``jog`` or ``home``.
:json number x: ``jog`` command: The amount to travel on the X axis in mm.
:json number y: ``jog`` command: The amount to travel on the Y axis in mm.
:json number z: ``jog`` command: The amount to travel on the Z axis in mm.
:json array axes: ``home`` command: The axes which to home, valid values are one or more of ``x``, ``y`` and ``z``.
:json number factor: ``feedrate`` command: The factor to apply to the feed rate, percentage between 50 and 200% as integer or float.
:statuscode 204: No error
:statuscode 400: Invalid axis specified, invalid value for travel amount for a jog command or factor for feed rate or otherwise invalid
:statuscode 400: Invalid axis specified, invalid value for travel amount for a jog command or otherwise invalid
request.
:statuscode 409: If the printer is not operational or currently printing.
@@ -350,7 +270,7 @@ Issue a tool command
Sets the given target temperature on the printer's tools. Additional parameters:
* ``targets``: Target temperature(s) to set, properties must match the format ``tool{n}`` with ``n`` being the
tool's index starting with 0. A value of `0` will turn the heater off.
tool's index starting with 0.
offset
Sets the given temperature offset on the printer's tools. Additional parameters:
@@ -367,21 +287,13 @@ Issue a tool command
Extrudes the given amount of filament from the currently selected tool. Additional parameters:
* ``amount``: The amount of filament to extrude in mm. May be negative to retract.
* ``speed``: Optional. Speed at which to extrude. If not provided, maximum speed for E axis from printer
profile will be used. Otherwise interpreted as an integer signifying the speed in mm/min, to append to the command.
flowrate
Changes the flow rate factor to apply to extrusion of the tool.
* ``factor``: The new factor, percentage between 75 and 125% as integer (``75`` to ``125``) or float (``0.75`` to ``1.25``).
All of these commands may only be sent if the printer is currently operational and -- in case of ``select`` and
``extrude`` -- not printing. Otherwise a :http:statuscode:`409` is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example Target Temperature Request**
Set the target temperature for the printer's first hotend to 220°C and the printer's second extruder to 205°C.
@@ -488,55 +400,14 @@ Issue a tool command
HTTP/1.1 204 No Content
**Example flow rate request (1/2)**
Set the flow rate factor to 95% using an integer attribute.
.. sourcecode:: http
POST /api/printer/tool HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "flowrate",
"factor": 95
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example flow rate request (2/2)**
Set the flow rate factor to 95% using a float attribute.
.. sourcecode:: http
POST /api/printer/tool HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "flowrate",
"factor": 0.95
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``target``, ``offset``, ``select`` or ``extrude``.
:json object targets: ``target`` command: The target temperatures to set. Valid properties have to match the format ``tool{n}``.
:json object offsets: ``offset`` command: The offset temperature to set. Valid properties have to match the format ``tool{n}``.
:json object tool: ``select`` command: The tool to select, value has to match the format ``tool{n}``.
:json object amount: ``extrude`` command: The amount of filament to extrude from the currently selected tool.
:json number factor: ``flowrate`` command: The factor to apply to the flow rate, percentage between 75 and 125% as integer or float.
:statuscode 204: No error
:statuscode 400: If ``targets`` or ``offsets`` contains a property or ``tool`` contains a value not matching the format
``tool{n}``, the target/offset temperature, extrusion amount or flow rate factor is not a valid number or outside of
``tool{n}``, the target/offset temperature or extrusion amount is not a valid number or outside of
the supported range, or if the request is otherwise invalid.
:statuscode 409: If the printer is not operational or -- in case of ``select`` or ``extrude`` -- currently printing.
@@ -628,12 +499,12 @@ Issue a bed command
are:
target
Sets the given target temperature on the printer's bed. Additional parameters:
Sets the given target temperature on the printer's tools. Additional parameters:
* ``target``: Target temperature to set. A value of `0` will turn the heater off.
* ``target``: Target temperature to set.
offset
Sets the given temperature offset on the printer's bed. Additional parameters:
Sets the given temperature offset on the printer's tools. Additional parameters:
* ``offset``: Offset to set.
@@ -642,11 +513,6 @@ Issue a bed command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
If no heated bed is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires user rights.
**Example Target Temperature Request**
Set the target temperature for the printer's heated bed to 75°C.
@@ -693,8 +559,7 @@ Issue a bed command
:statuscode 204: No error
:statuscode 400: If ``target`` or ``offset`` is not a valid number or outside of the supported range, or if the
request is otherwise invalid.
:statuscode 409: If the printer is not operational or the selected printer profile
does not have a heated bed.
:statuscode 409: If the printer is not operational.
.. _sec-api-printer-bedstate:
@@ -711,11 +576,8 @@ Retrieve the current bed state
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
If no heated bed is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
.. note::
If you want tool, bed and chamber temperature information at the same time, take a look at
If you want both tool and bed temperature information at the same time, take a look at
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
**Example**
@@ -762,156 +624,7 @@ Retrieve the current bed state
:query limit: If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history
will be returned. Will be ignored if ``history`` is not enabled.
:statuscode 200: No error
:statuscode 409: If the printer is not operational or the selected printer profile
does not have a heated bed.
.. _sec-api-printer-chambercommand:
Issue a chamber command
=======================
.. http:post:: /api/printer/chamber
Chamber commands allow setting the temperature and temperature offsets for the printer's heated chamber. Available commands
are:
target
Sets the given target temperature on the printer's chamber. Additional parameters:
* ``target``: Target temperature to set. A value of `0` will turn the heater off.
offset
Sets the given temperature offset on the printer's chamber. Additional parameters:
* ``offset``: Offset to set.
All of these commands may only be sent if the printer is currently operational. Otherwise a :http:statuscode:`409`
is returned.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
If no heated chamber is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
Requires user rights.
**Example Target Temperature Request**
Set the target temperature for the printer's heated chamber to 50°C.
.. sourcecode:: http
POST /api/printer/chamber HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "target",
"target": 50
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example Offset Temperature Request**
Set the temperature offset for the heated chamber to -5°C.
.. sourcecode:: http
POST /api/printer/chamber HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "offset",
"offset": -5
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``target`` or ``offset``.
:json object target: ``target`` command: The target temperature to set.
:json object offset: ``offset`` command: The offset temperature to set.
:statuscode 204: No error
:statuscode 400: If ``target`` or ``offset`` is not a valid number or outside of the supported range, or if the
request is otherwise invalid.
:statuscode 409: If the printer is not operational or the selected printer profile
does not have a heated chamber.
.. _sec-api-printer-chamberstate:
Retrieve the current chamber state
==================================
.. http:get:: /api/printer/chamber
Retrieves the current temperature data (actual, target and offset) plus optionally a (limited) history (actual, target,
timestamp) for the printer's heated chamber.
It's also possible to retrieve the temperature history by supplying the ``history`` query parameter set to ``true``. The
amount of returned history data points can be limited using the ``limit`` query parameter.
Returns a :http:statuscode:`200` with a Temperature Response in the body upon success.
If no heated chamber is configured for the currently selected printer profile, the resource will return
an :http:statuscode:`409`.
.. note::
If you want tool, bed and chamber temperature information at the same time, take a look at
:ref:`Retrieve the current printer state <sec-api-printer-state>`.
**Example**
Query the chamber temperature data and also include the temperature history but limit it to two entries.
.. sourcecode:: http
GET /api/printer/chamber?history=true&limit=2 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"chamber": {
"actual": 50.221,
"target": 70.0,
"offset": 5
},
"history": [
{
"time": 1395651928,
"chamber": {
"actual": 50.221,
"target": 70.0
}
},
{
"time": 1395651926,
"chamber": {
"actual": 49.1123,
"target": 70.0
}
}
]
}
:query history: If set to ``true`` (or: ``yes``, ``y``, ``1``), history information will be included in the response
too. If no ``limit`` parameter is given, all available temperature history data will be returned.
:query limit: If set to an integer (``n``), only the last ``n`` data points from the printer's temperature history
will be returned. Will be ignored if ``history`` is not enabled.
:statuscode 200: No error
:statuscode 409: If the printer is not operational or the selected printer profile
does not have a heated chamber.
:statuscode 409: If the printer is not operational.
.. _sec-api-printer-sdcommand:
@@ -926,7 +639,7 @@ Issue an SD command
init
Initializes the printer's SD card, making it available for use. This also includes an initial retrieval of the
list of files currently stored on the SD card, so after issuing that command a :ref:`retrieval of the files
list of files currently stored on the SD card, so after issueing that command a :ref:`retrieval of the files
on SD card <sec-api-fileops-retrievelocation>` will return a successful result.
.. note::
@@ -944,8 +657,6 @@ Issue an SD command
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example Init Request**
Initialize the SD card.
@@ -1044,67 +755,10 @@ Retrieve the current SD state
:statuscode 200: No error
:statuscode 404: If SD support has been disabled in OctoPrint's config.
.. _sec-api-printer-arbcommand:
Send an arbitrary command to the printer
========================================
.. http:post:: /api/printer/command
Sends any command to the printer via the serial interface. Should be used with some care as some commands can interfere with
or even stop a running print job.
Expects a :ref:`Arbitrary Command Request <sec-api-printer-datamodel-arbcommand>` as the request's body.
If successful returns a :http:statuscode:`204` and an empty body.
Requires user rights.
**Example for sending a single command**
.. sourcecode:: http
POST /api/printer/command HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "M106"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example for sending multiple commands**
.. sourcecode:: http
POST /api/printer/command HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"commands": [
"M18",
"M106 S0"
]
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: Single command to send to the printer, mutually exclusive with ``commands``.
:json string commands: List of commands to send to the printer, mutually exclusive with ``command``.
:statuscode 204: No error
.. _sec-api-printer-datamodel:
Data model
==========
Datamodel
=========
.. _sec-api-printer-datamodel-fullstate:
@@ -1153,8 +807,7 @@ Temperature State
* - ``bed``
- 0..1
- :ref:`Temperature Data <sec-api-datamodel-printer-tempdata>`
- Current temperature stats for the printer's heated bed. Not included if querying only tool state or if
the currently selected printer profile does not have a heated bed.
- Current temperature stats for the printer's heated bed. Not included if querying only tool state.
* - ``history``
- 0..1
- List of :ref:`Historic Temperature Datapoint <sec-api-datamodel-printer-temphistory>`
@@ -1178,36 +831,3 @@ SD State
- Boolean
- Whether the SD card has been initialized (``true``) or not (``false``).
.. _sec-api-printer-datamodel-arbcommand:
Arbitrary Command Request
-------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``command``
- 0..1
- String
- Single command to send to the printer, mutually exclusive with ``commands`` and ``script``.
* - ``commands``
- 0..*
- Array of String
- Multiple commands to send to the printer (in the given order), mutually exclusive with ``command`` and ``script``.
* - ``script``
- 0..*
- String
- Name of the GCODE script template to send to the printer, mutually exclusive with ``command`` and ``commands``.
* - ``parameters``
- 0..1
- Map of key value pairs
- Key value pairs of parameters to replace in sent commands/provide to the script renderer
* - ``context``
- 0..1
- Map of key value pairs
- (only if ``script`` is set) additional template variables to provide to the script renderer
+12 -443
View File
@@ -17,113 +17,6 @@ Retrieve all printer profiles
.. http:get:: /api/printerprofiles
Retrieves a list of all configured printer profiles.
Returns a :http:statuscode:`200` with a list of :ref:`profiles <sec-api-printerprofiles-datamodel-profile>`.
**Example**
.. sourcecode:: http
GET /api/printerprofiles HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"profiles": [
{
"id": "_default",
"name": "Default",
"color": "default",
"model": "Generic RepRap Printer",
"default": true,
"current": true,
"resource": "http://example.com/api/printerprofiles/_default",
"volume": {
"formFactor": "rectangular",
"origin": "lowerleft",
"width": 200,
"depth": 200,
"height": 200
},
"heatedBed": true,
"heatedChamber": false,
"axes": {
"x": {
"speed": 6000,
"inverted": false
},
"y": {
"speed": 6000,
"inverted": false
},
"z": {
"speed": 200,
"inverted": false
},
"e": {
"speed": 300,
"inverted": false
}
},
"extruder": {
"count": 1,
"offsets": [
{"x": 0.0, "y": 0.0}
]
}
},
{
"id": "my_profile",
"name": "My Profile",
"color": "default",
"model": "My Custom Printer",
"default": false,
"current": false,
"resource": "http://example.com/api/printerprofiles/my_profile",
"volume": {
"formFactor": "rectangular",
"origin": "lowerleft",
"width": 200,
"depth": 200,
"height": 200
},
"heatedBed": true,
"heatedChamber": true,
"axes": {
"x": {
"speed": 6000,
"inverted": false
},
"y": {
"speed": 6000,
"inverted": false
},
"z": {
"speed": 200,
"inverted": false
},
"e": {
"speed": 300,
"inverted": false
}
},
"extruder": {
"count": 1,
"offsets": [
{"x": 0.0, "y": 0.0}
]
}
},
]
}
.. _sec-api-printerprofiles-add:
Add a new printer profile
@@ -131,174 +24,6 @@ Add a new printer profile
.. http:post:: /api/printerprofiles
Adds a new printer profile based on either the current default profile
or the profile identified in ``basedOn``.
The provided profile data will be merged with the profile data from the
base profile.
If a profile with the same ``id`` does already exist, a :http:statuscode:`400`
will be returned.
Returns a :http:statuscode:`200` with the saved profile as property ``profile``
in the JSON body upon success.
Requires admin rights.
**Example 1**
Creating a new profile ``some_profile`` based on the current default profile.
.. sourcecode:: http
POST /api/printerprofiles HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"profile": {
"id": "some_profile",
"name": "Some profile",
"model": "Some cool model"
}
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"profile": {
"id": "some_profile",
"name": "Some profile",
"color": "default",
"model": "Some cool model",
"default": false,
"current": false,
"resource": "http://example.com/api/printerprofiles/some_profile",
"volume": {
"formFactor": "rectangular",
"origin": "lowerleft",
"width": 200,
"depth": 200,
"height": 200
},
"heatedBed": true,
"heatedChamber": false,
"axes": {
"x": {
"speed": 6000,
"inverted": false
},
"y": {
"speed": 6000,
"inverted": false
},
"z": {
"speed": 200,
"inverted": false
},
"e": {
"speed": 300,
"inverted": false
}
},
"extruder": {
"count": 1,
"offsets": [
{"x": 0.0, "y": 0.0}
]
}
}
}
**Example 2**
Creating a new profile ``some_other_profile`` based on existing profile
``some_profile``.
.. sourcecode:: http
POST /api/printerprofiles HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"profile": {
"id": "some_other_profile",
"name": "Some other profile",
"heatedBed": false,
"volume": {
"formFactor": "circular",
"origin": "center",
"width": "150",
"height": "300"
},
"extruder": {
"count": 2,
"offsets": [
{"x": 0.0, "y": 0.0},
{"x": 21.6, "y": 0.0}
]
}
},
"basedOn": "some_profile"
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"profile": {
"id": "some_other_profile",
"name": "Some other profile",
"color": "default",
"model": "Some cool model",
"default": false,
"current": false,
"resource": "http://example.com/api/printerprofiles/some_other_profile",
"volume": {
"formFactor": "circular",
"origin": "center",
"width": 150,
"depth": 150,
"height": 300
},
"heatedBed": false,
"heatedChamber": false,
"axes": {
"x": {
"speed": 6000,
"inverted": false
},
"y": {
"speed": 6000,
"inverted": false
},
"z": {
"speed": 200,
"inverted": false
},
"e": {
"speed": 300,
"inverted": false
}
},
"extruder": {
"count": 2,
"offsets": [
{"x": 0.0, "y": 0.0},
{"x": 21.6, "y": 0.0}
]
}
}
}
.. _sec-api-printerporfiles-update:
Update an existing printer profile
@@ -306,86 +31,6 @@ Update an existing printer profile
.. http:patch:: /api/printerprofiles/(string:profile)
Updates an existing printer profile by its ``profile`` identifier.
The updated (potentially partial) profile is expected in the request's body as part of
an :ref:`Add or update request <sec-api-printerprofiles-datamodel-update>`.
Returns a :http:statuscode:`200` with the saved profile as property ``profile``
in the JSON body upon success.
Requires admin rights.
**Example**
.. sourcecode:: http
PATCH /api/printerprofiles/some_profile HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"profile": {
"name": "Some edited profile",
"volume": {
"depth": "300"
}
}
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"profile": {
"id": "some_profile",
"name": "Some edited profile",
"color": "default",
"model": "Some cool model",
"default": false,
"current": false,
"resource": "http://example.com/api/printerprofiles/some_profile",
"volume": {
"formFactor": "rectangular",
"origin": "lowerleft",
"width": 200,
"depth": 300,
"height": 200
},
"heatedBed": true,
"heatedChamber": false,
"axes": {
"x": {
"speed": 6000,
"inverted": false
},
"y": {
"speed": 6000,
"inverted": false
},
"z": {
"speed": 200,
"inverted": false
},
"e": {
"speed": 300,
"inverted": false
}
},
"extruder": {
"count": 2,
"offsets": [
{"x": 0.0, "y": 0.0},
{"x": 21.6, "y": 0.0}
]
}
}
}
.. _sec-api-printerprofiles-delete:
Remove an existing printer profile
@@ -393,32 +38,10 @@ Remove an existing printer profile
.. http:delete:: /api/printerprofiles/(string:profile)
Deletes an existing printer profile by its ``profile`` identifier.
If the profile to be deleted is the currently selected profile, a :http:statuscode:`409` will be
returned.
Returns a :http:statuscode:`204` an empty body upon success.
Requires admin rights.
**Example**
.. sourcecode:: http
DELETE /api/printerprofiles/some_profile HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 204 No Content
.. _sec-api-printerprofiles-datamodel:
Data model
==========
Datamodel
=========
.. _sec-api-printerprofiles-datamodel-profilelist:
@@ -442,7 +65,7 @@ Profile list
- :ref:`Profile <sec-api-slicing-datamodel-profile>`
- Information about a profile stored in the system.
.. _sec-api-printerprofiles-datamodel-update:
.. _sec-api-slicing-datamodel-update:
Add or update request
---------------------
@@ -458,18 +81,10 @@ Add or update request
* - ``profiles``
- 1
- :ref:`Profile <sec-api-slicing-datamodel-profile>`
- Information about the profile being added/updated. Only the values to be overwritten need to be supplied.
Unset fields will be taken from the base profile, which for add requests will be the
current default profile unless a different base is defined in the ``basedOn`` property
of the request. For update requests the current version of the profile to be updated will
be used as base.
* - ``basedOn``
- 0..1
- ``string``
- Only for add requests, ignored on updates: The identifier of the profile to base the
new profile on, if different than the current default profile.
- Information about the profile being added/updated. For adding new profiles, all fields must be populated. For updating
and existing profile, only the values to be overwritten need to be supplied.
.. _sec-api-printerprofiles-datamodel-profile:
.. _sec-api-slicing-datamodel-profile:
Profile
-------
@@ -486,14 +101,12 @@ Profile
- 0..1
- ``string``
- Identifier of the profile. Will always be
returned in responses, is mandatory in add requests but
can be left out of update requests.
returned in responses but can be left out of save/update requests.
* - ``name``
- 0..1
- ``string``
- Display name of the profile. Will always be
returned in responses, is mandatory in add requests but
can be left out of update requests.
returned in responses but can be left out of save/update requests.
* - ``color``
- 0..1
- ``string``
@@ -527,75 +140,31 @@ Profile
- 0..1
- ``string``
- The form factor of the printer's bed, valid values are "rectangular" and "circular"
* - ``volume.origin``
- 0..1
- ``string``
- The location of the origin on the printer's bed, valid values are "lowerleft" and "center"
* - ``volume.width``
- 0..1
- ``float``
- The width of the print volume. For circular beds, the diameter of the bed.
- The width of the print volume
* - ``volume.depth``
- 0..1
- ``float``
- The depth of the print volume. For circular beds, this is the diameter of the bed and will be forced to be the same
as ``volume.width`` upon saving.
- The depth of the print volume
* - ``volume.height``
- 0..1
- ``float``
- The height of the print volume
* - ``volume.custom_box``
- 0..1
- ``boolean`` or ``object``
- If the printer has a custom bounding box where the print head can be safely moved to, exceeding the defined print
volume, that bounding box will be defined here. Otherwise (safe area == print volume) this value will be ``false``.
* - ``volume.custom_box.min_x``
- 0..1
- ``float``
- Minimum X coordinate defining the safe custom bounding box. Smaller value than the minimum X coordinate of the
print volume.
* - ``volume.custom_box.max_x``
- 0..1
- ``float``
- Maximum X coordinate defining the safe custom bounding box. Larger value than the maximum X coordinate of the
print volume.
* - ``volume.custom_box.min_y``
- 0..1
- ``float``
- Minimum Y coordinate defining the safe custom bounding box. Smaller value than the minimum Y coordinate of the
print volume.
* - ``volume.custom_box.max_y``
- 0..1
- ``float``
- Maximum Y coordinate defining the safe custom bounding box. Larger value than the maximum Y coordinate of the
print volume.
* - ``volume.custom_box.min_z``
- 0..1
- ``float``
- Minimum Z coordinate defining the safe custom bounding box. Smaller value than the minimum Z coordinate of the
print volume.
* - ``volume.custom_box.max_z``
- 0..1
- ``float``
- Maximum Z coordinate defining the safe custom bounding box. Larger value than the maximum Z coordinate of the
print volume.
* - ``heatedBed``
- 0..1
- ``boolean``
- Whether the printer has a heated bed (``true``) or not (``false``)
* - ``heatedChamber``
- 0..1
- ``boolean``
- Whether the printer has a heated chamber (``true``) or not (``false``)
* - ``axes``
- 0..1
- Object
- Description of the printer's axes properties, one entry each for ``x``, ``y``, ``z`` and ``e`` holding maximum speed
- Description of the printer's axes properties, one entry each for ``x``, ``y``, ``z`` and ``e`` holding maxium speed
and whether this axis is inverted or not.
* - ``axes.{axis}.speed``
- 0..1
- ``int``
- Maximum speed of the axis in mm/min.
- Maximum speed of the axis in mm/s.
* - ``axes.{axis}.inverted``
- 0..1
- ``boolean``
+5 -87
View File
@@ -12,7 +12,7 @@ Push updates
.. contents::
To enable real time information exchange between client and server, OctoPrint uses
To enable real time information exchange between client and server, OctoPrint uses
`SockJS <https://github.com/sockjs/sockjs-protocol>`_ to push
status updates, temperature changes etc to connected web interface instances.
@@ -27,108 +27,26 @@ Each pushed message consists of a simple JSON object that follows this basic str
``type`` indicates the type of message being pushed to the client, the attached ``payload`` is message specific. The
following message types are currently available for usage by 3rd party clients:
* ``connected``: Initial connection information, sent only right after establishing the socket connection. See
:ref:`the payload data model <sec-api-push-datamodel-connected>`.
* ``current``: Rate limited general state update, payload contains information about the printer's state, job progress,
accumulated temperature points and log lines since last update. OctoPrint will send these updates when new information
is available, but not more often than twice per second in order to not flood the client with messages (e.g.
during printing). See :ref:`the payload data model <sec-api-push-datamodel-currentandhistory>`.
* ``history``: Current state, temperature and log history, sent upon initial connect to get the client up to date. Same
payload data model as ``current``, see :ref:`the payload data model <sec-api-push-datamodel-currentandhistory>`.
payload data model as ``current``, see :ref:`below <sec-api-push-datamodel-currentandhistory>`.
* ``event``: Events triggered within OctoPrint, such as e.g. ``PrintFailed`` or ``MovieRenderDone``. Payload is the event
type and payload, see :ref:`the payload data model <sec-api-push-datamodel-event>`. Sent when an event is triggered internally.
type and payload, see :ref:`below <sec-api-push-datamodel-event>`. Sent when an event is triggered internally.
* ``slicingProgress``: Progress updates from an active slicing background job, payload contains information about the
model being sliced, the target file, the slicer being used and the progress as a percentage.
See :ref:`the payload data model <sec-api-push-datamodel-slicingprogress>`.
* ``plugin``: Messages generated by plugins. The payload data models are determined by the plugin which sent the
message.
Clients must ignore any unknown messages.
The data model of the attached payloads is described further below.
OctoPrint's SockJS socket also accepts two commands from the client to the server.
* ``auth`` (since 1.3.10): With the ``auth`` message, clients may associate an
existing user session with the socket. That is of special importance to receive
any kind of messages if the bundled :ref:`Forcelogin Plugin <sec-bundledplugins-forcelogin>` is enabled
(as it is by default), since it will prevent any kind of status messages to be sent to connected unauthenticated
clients.
The ``auth`` message expects the user id of the user to authenticate followed by ``:`` and a session key to be
obtained from the successful payload of a :ref:`(passive or active) login via the API <sec-api-general-login>`.
Example for a ``auth`` client-server-message:
.. sourcecode:: javascript
{
"auth": "someuser:LGZ0trf8By"
}
* ``throttle``: Usually, OctoPrint will push the general state update
in the ``current`` message twice per second. For some clients that might still
be too fast, so they can signal a different factor to OctoPrint utilizing the
``throttle`` message. OctoPrint expects a single integer here which represents
the multiplier for the base rate limit of one message every 500ms. A value of
1 hence will produce the default behaviour of getting every update. A value of
2 will set the rate limit to maximally one message every 1s, 3 to maximally one
message every 1.5s and so on.
Example for a ``throttle`` client-server-message:
.. sourcecode:: javascript
{
"throttle": 2
}
.. _sec-api-push-datamodel:
Data model
==========
.. _sec-api-push-datamodel-connected:
``connected`` payload
---------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``apikey``
- 1
- String
- Current UI API KEY. The UI API KEY is a special API key that gets regenerated on every server restart and
has no rights attached other than accessing the REST API. An additional browser session is needed to
send valid requests when the UI API KEY is used.
* - ``version``
- 1
- String
- The server's version.
* - ``branch``
- 1
- String
- The source code branch from which the server was built.
* - ``display_version``
- 1
- String
- The server's version and branch in a human readable format.
* - ``plugin_hash``
- 1
- String
- A hash of all installed plugins. This allows to detect if there have been plugin changes between server
restarts.
* - ``config_hash``
- 1
- String
- A hash of the currently active config. This allows to detect if there have been configuration changes between
server restarts.
Datamodel
=========
.. _sec-api-push-datamodel-currentandhistory:
-524
View File
@@ -1,524 +0,0 @@
.. _sec-api-settings:
********
Settings
********
.. contents::
.. _sec-api-settings-retrieve:
Retrieve current settings
=========================
.. http:get:: /api/settings
Retrieves the current configuration of OctoPrint.
Returns a :http:statuscode:`200` with the current settings as a JSON object in the
response body.
The :ref:`data model <sec-api-settings-datamodel>` is similar to what can be found in
:ref:`config.yaml <sec-configuration-config_yaml>`, see below for details.
.. _sec-api-settings-save:
Save settings
=============
.. http:post:: /api/settings
Saves the provided settings in OctoPrint.
Expects a JSON object with the settings to change as request body. This can be either a
full settings tree, or only a partial tree containing only those fields that should
be updated.
Returns the currently active settings on success, as part of a :http:statuscode:`200` response.
Requires admin rights.
**Example**
Only change the UI color to black.
.. sourcecode:: http
POST /api/settings HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"appearance": {
"color": "black"
}
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"api": {
"enabled": true
},
"appearance": {
"color": "black"
}
}
.. _sec-api-settings-generateapikey:
Regenerate the system wide API key
==================================
.. http:post:: /api/settings/apikey
Generates a new system wide API key.
Does not expect a body. Will return the generated API key as ``apikey``
property in the JSON object contained in the response body.
Requires admin rights.
:status 200: No error
:status 403: No admin rights
.. _sec-api-settings-fetchtemplaatedata:
Fetch template data
===================
.. http:get:: /api/settings/templates
Fetch data (currently only the sorting order) of all registered template components in the system.
Use this to get a full list of the identifiers of all UI components provided either by core OctoPrint or any
currently active plugins.
Example:
.. sourcecode:: http
GET /api/settings/templates HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"order": {
"about": [
{
"id": "about",
"name": "About OctoPrint"
},
{
"id": "supporters",
"name": "Supporters"
},
{
"id": "authors",
"name": "Authors"
},
{
"id": "changelog",
"name": "Changelog"
},
{
"id": "license",
"name": "OctoPrint License"
},
{
"id": "thirdparty",
"name": "Third Party Licenses"
},
{
"id": "plugin_pluginmanager",
"name": "Plugin Licenses",
"plugin_id": "pluginmanager",
"plugin_name": "Plugin Manager"
}
],
"generic": [
{
"id": "plugin_announcements",
"name": "plugin_announcements",
"plugin_id": "announcements",
"plugin_name": "Announcement Plugin"
}
],
"navbar": [
{
"id": "settings",
"name": "settings"
},
{
"id": "systemmenu",
"name": "systemmenu"
},
{
"id": "plugin_announcements",
"name": "plugin_announcements",
"plugin_id": "announcements",
"plugin_name": "Announcement Plugin"
},
{
"id": "login",
"name": "login"
}
],
"plugin_pluginmanager_about_thirdparty": [],
"settings": [
{
"id": "section_printer",
"name": "Printer"
},
{
"id": "serial",
"name": "Serial Connection"
},
{
"id": "printerprofiles",
"name": "Printer Profiles"
},
{
"id": "temperatures",
"name": "Temperatures"
},
{
"id": "terminalfilters",
"name": "Terminal Filters"
},
{
"id": "gcodescripts",
"name": "GCODE Scripts"
},
{
"id": "section_features",
"name": "Features"
},
{
"id": "features",
"name": "Features"
},
{
"id": "webcam",
"name": "Webcam & Timelapse"
},
{
"id": "accesscontrol",
"name": "Access Control"
},
{
"id": "gcodevisualizer",
"name": "GCODE Visualizer"
},
{
"id": "api",
"name": "API"
},
{
"id": "section_octoprint",
"name": "OctoPrint"
},
{
"id": "server",
"name": "Server"
},
{
"id": "folders",
"name": "Folders"
},
{
"id": "appearance",
"name": "Appearance"
},
{
"id": "plugin_logging",
"name": "Logging",
"plugin_id": "logging",
"plugin_name": "Logging"
},
{
"id": "plugin_pluginmanager",
"name": "Plugin Manager",
"plugin_id": "pluginmanager",
"plugin_name": "Plugin Manager"
},
{
"id": "plugin_softwareupdate",
"name": "Software Update",
"plugin_id": "softwareupdate",
"plugin_name": "Software Update"
},
{
"id": "plugin_announcements",
"name": "Announcements",
"plugin_id": "announcements",
"plugin_name": "Announcement Plugin"
},
{
"id": "section_plugins",
"name": "Plugins"
},
{
"id": "plugin_action_command_prompt",
"name": "Action Command Prompt",
"plugin_id": "action_command_prompt",
"plugin_name": "Action Command Prompt Support"
},
{
"id": "plugin_curalegacy",
"name": "Cura Legacy",
"plugin_id": "curalegacy",
"plugin_name": "Cura Legacy"
}
],
"sidebar": [
{
"id": "plugin_printer_safety_check",
"name": "Printer Safety Warning",
"plugin_id": "printer_safety_check",
"plugin_name": "Printer Safety Check"
},
{
"id": "connection",
"name": "Connection"
},
{
"id": "state",
"name": "State"
},
{
"id": "files",
"name": "Files"
}
],
"tab": [
{
"id": "temperature",
"name": "Temperature"
},
{
"id": "control",
"name": "Control"
},
{
"id": "gcodeviewer",
"name": "GCode Viewer"
},
{
"id": "terminal",
"name": "Terminal"
},
{
"id": "timelapse",
"name": "Timelapse"
}
],
"usersettings": [
{
"id": "access",
"name": "Access"
},
{
"id": "interface",
"name": "Interface"
}
],
"wizard": []
}
}
Requires admin rights.
.. warning::
This API endpoint is in beta. Things might change. If you happen to want to develop against it, you should drop
me an email to make sure I can give you a heads-up when something changes in an backwards incompatible way.
:status 200: No error
:status 403: No admin rights
.. _sec-api-settings-datamodel:
Data model
==========
The data model on the settings API mostly reflects the contents of
:ref:`config.yaml <sec-configuration-config_yaml>`. The settings tree
returned by the API contains the following fields, which are directly
mapped from the same fields in ``config.yaml`` unless otherwise noted:
.. list-table::
:header-rows: 1
* - Field
- Notes
* - ``api.enabled``
-
* - ``api.key``
- Only maps to ``api.key`` in ``config.yaml`` if request is sent with admin rights, set to ``n/a`` otherwise.
Starting with OctoPrint 1.3.3 setting this field via :ref:`the API <sec-api-settings-save>` is not possible,
only :ref:`regenerating it <sec-api-settings-generateapikey>` is supported. Setting a custom value is only
possible through `config.yaml`.
* - ``api.allowCrossOrigin``
-
* - ``appearance.name``
-
* - ``appearance.color``
-
* - ``appearance.colorTransparent``
-
* - ``appearance.defaultLanguage``
-
* - ``appearance.showFahrenheitAlso``
-
* - ``feature.gcodeViewer``
- Maps to ``gcodeViewer.enabled`` in ``config.yaml``
* - ``feature.sizeThreshold``
- Maps to ``gcodeViewer.sizeThreshold`` in ``config.yaml``
* - ``feature.mobileSizeThreshold``
- Maps to ``gcodeViewer.mobileSizeThreshold`` in ``config.yaml``
* - ``feature.temperatureGraph``
-
* - ``feature.waitForStart``
-
* - ``feature.alwaysSendChecksum``
-
* - ``feature.neverSendChecksum``
-
* - ``feature.sdSupport``
-
* - ``feature.sdRelativePath``
-
* - ``feature.sdAlwaysAvailable``
-
* - ``feature.swallowOkAfterResend``
-
* - ``feature.repetierTargetTemp``
-
* - ``feature.externalHeatupDetection``
-
* - ``feature.keyboardControl``
-
* - ``feature.pollWatched``
-
* - ``feature.ignoreIdenticalResends``
-
* - ``feature.modelSizeDetection``
-
* - ``feature.firmwareDetection``
-
* - ``feature.printCancelConfirmation``
-
* - ``feature.blockWhileDwelling``
-
* - ``folder.uploads``
-
* - ``folder.timelapse``
-
* - ``folder.timelapseTmp``
- Maps to ``folder.timelapse_tmp`` in ``config.yaml``
* - ``folder.logs``
-
* - ``folder.watched``
-
* - ``plugins``
- Plugin settings as available from ``config.yaml`` and :class:`~octoprint.plugin.SettingsPlugin` implementations
* - ``printer.defaultExtrusionLength``
- Maps to ``printerParameters.defaultExtrusionLength`` in ``config.yaml``
* - ``scripts.gcode``
- Whole subtree of configured :ref:`GCODE scripts <sec-features-gcode_scripts>`
* - ``serial.port``
- Current serial port
* - ``serial.baudrate``
- Current serial baudrate
* - ``serial.portOptions``
- Available serial ports
* - ``serial.baudrateOptions``
- Available serial baudrates
* - ``serial.autoconnect``
-
* - ``serial.timeoutConnection``
- Maps to ``serial.timeout.connection`` in ``config.yaml``
* - ``serial.timeoutDetection``
- Maps to ``serial.timeout.detection`` in ``config.yaml``
* - ``serial.timeoutCommunication``
- Maps to ``serial.timeout.communication`` in ``config.yaml``
* - ``serial.timeoutTemperature``
- Maps to ``serial.timeout.temperature`` in ``config.yaml``
* - ``serial.timeoutTemperatureTargetSet``
- Maps to ``serial.timeout.temperatureTargetSet`` in ``config.yaml``
* - ``serial.timeoutSdStatus``
- Maps to ``serial.timeout.sdStatus`` in ``config.yaml``
* - ``serial.log``
-
* - ``serial.additionalPorts``
-
* - ``serial.additionalBaudrates``
-
* - ``serial.longRunningCommands``
-
* - ``serial.checksumRequiringCommands``
-
* - ``serial.helloCommand``
-
* - ``serial.ignoreErrorsFromFirmware``
-
* - ``serial.disconnectOnErrors``
-
* - ``serial.triggerOkForM29``
-
* - ``serial.supportResendsWIthoutOk``
-
* - ``serial.maxTimeoutsIdle``
- Maps to ``serial.maxCommunicationTimeouts.idle`` in ``config.yaml``
* - ``serial.maxTimeoutsPrinting``
- Maps to ``serial.maxCommunicationTimeouts.printing`` in ``config.yaml``
* - ``serial.maxTimeoutsLong``
- Maps to ``serial.maxCommunicationTimeouts.long`` in ``config.yaml``
* - ``server.commands.systemShutdownCommand``
-
* - ``server.commands.systemRestartCommand``
-
* - ``server.commands.serverRestartCommand``
-
* - ``server.diskspace.warning``
-
* - ``server.diskspace.critical``
-
* - ``system.actions``
- Whole subtree taken from ``config.yaml``
* - ``system.events``
- Whole subtree taken from ``config.yaml``
* - ``temperature.profiles``
- Whole subtree taken from ``config.yaml``
* - ``temperature.cutoff``
-
* - ``terminalFilters``
- Whole subtree taken from ``config.yaml``
* - ``webcam.streamUrl``
- Maps to ``webcam.stream`` in ``config.yaml``
* - ``webcam.snapshotUrl``
- Maps to ``webcam.snapshot`` in ``config.yaml``
* - ``webcam.ffmpegPath``
- Maps to ``webcam.ffmpeg`` in ``config.yaml``
* - ``webcam.bitrate``
-
* - ``webcam.ffmpegThreads``
-
* - ``webcam.watermark``
-
* - ``webcam.flipH``
-
* - ``webcam.flipV``
-
* - ``webcam.rotate90``
-
+29 -35
View File
@@ -32,7 +32,7 @@ List All Slicers and Slicing Profiles
.. sourcecode:: http
GET /api/slicing HTTP/1.1
GET /api/slicing/profiles HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
@@ -42,25 +42,27 @@ List All Slicers and Slicing Profiles
Content-Type: application/json
{
"curalegacy": {
"key": "curalegacy",
"displayName": "Cura Legacy",
"cura": {
"key": "cura",
"displayName": "CuraEngine",
"default": true,
"profiles": {
"high_quality": {
"key": "high_quality",
"displayName": "High Quality",
"default": false,
"resource": "http://example.com/api/slicing/curalegacy/profiles/high_quality"
"resource": "http://example.com/api/slicing/cura/profiles/high_quality"
},
"medium_quality": {
"key": "medium_quality",
"displayName": "Medium Quality",
"default": true,
"resource": "http://example.com/api/slicing/curalegacy/profiles/medium_quality"
}
"resource": "http://example.com/api/slicing/cura/profiles/medium_quality"
},
...
}
}
},
...
}
:statuscode 200: No error
@@ -81,7 +83,7 @@ List Slicing Profiles of a Specific Slicer
.. sourcecode:: http
GET /api/slicing/curalegacy/profiles HTTP/1.1
GET /api/slicing/cura/profiles HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
@@ -95,19 +97,20 @@ List Slicing Profiles of a Specific Slicer
"key": "high_quality",
"displayName": "High Quality",
"default": false,
"resource": "http://example.com/api/slicing/curalegacy/profiles/high_quality"
"resource": "http://example.com/api/slicing/cura/profiles/high_quality"
},
"medium_quality": {
"key": "medium_quality",
"displayName": "Medium Quality",
"default": true,
"resource": "http://example.com/api/slicing/curalegacy/profiles/medium_quality"
}
"resource": "http://example.com/api/slicing/cura/profiles/medium_quality"
},
...
}
:param slicer: The identifying key of the slicer for which to list the available profiles.
:statuscode 200: No error
:statuscode 404: If the ``slicer`` was unknown to the system or not yet configured.
:statuscode 404: If the ``slicer`` was unknown to the system.
.. _sec-api-slicing-listspecific:
@@ -125,7 +128,7 @@ Retrieve Specific Profile
.. sourcecode:: http
GET /api/slicing/curalegacy/profiles/quick_test HTTP/1.1
GET /api/slicing/cura/profiles/quick_test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
@@ -137,21 +140,22 @@ Retrieve Specific Profile
{
"displayName": "Just a test",
"description": "This is just a test",
"resource": "http://example.com/api/slicing/curalegacy/profiles/quick_test",
"resource": "http://example.com/api/slicing/cura/profiles/quick_test",
"data": {
"bottom_layer_speed": 20.0,
"bottom_thickness": 0.3,
"brim_line_count": 20,
"cool_head_lift": false,
"cool_min_feedrate": 10.0,
"cool_min_layer_time": 5.0
"cool_min_layer_time": 5.0,
...
}
}
:param slicer: The identifying key of the slicer for which to list the available profiles.
:param name: The identifying key of the profile to retrieve
:statuscode 200: No error
:statuscode 404: If the ``slicer`` or the profile ``key`` was unknown to the system.
:statuscode 404: If the ``slicer`` or the profile was unknown to the system.
.. _sec-api-slicing-add:
@@ -168,20 +172,18 @@ Add Slicing Profile
Returns a :http:statuscode:`201` and an :ref:`abridged Profile <sec-api-slicing-datamodel-profile>` in the body
upon successful completion.
Requires admin rights.
**Example**
.. sourcecode:: http
PUT /api/slicing/curalegacy/profiles/quick_test HTTP/1.1
PUT /api/slicing/cura/profiles/quick_test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"displayName": "Just a test",
"description": "This is just a test to show how to create a curalegacy profile with a different layer height and skirt count",
"description": "This is just a test to show how to create a cura profile with a different layer height and skirt count",
"data": {
"layer_height": 0.2,
"skirt_line_count": 3
@@ -197,8 +199,8 @@ Add Slicing Profile
{
"displayName": "Just a test",
"description": "This is just a test to show how to create a curalegacy profile with a different layer height and skirt count",
"resource": "http://example.com/api/slicing/curalegacy/profiles/quick_test"
"description": "This is just a test to show how to create a cura profile with a different layer height and skirt count",
"resource": "http://example.com/api/slicing/cura/profiles/quick_test"
}
:param slicer: The identifying key of the slicer for which to add the profile
@@ -213,10 +215,7 @@ Delete Slicing Profile
.. http:delete:: /api/slicing/(string:slicer)/profiles/(string:key)
Delete the slicing profile identified by ``key`` for the slicer ``slicer``. If the profile doesn't exist, the
request will succeed anyway.
Requires admin rights.
Delete the slicing profile identified by ``key`` for the slicer ``slicer``.
:param slicer: The identifying key of the slicer for which to delete the profile
:param key: The identifying key of the profile to delete
@@ -225,8 +224,8 @@ Delete Slicing Profile
.. _sec-api-slicing-datamodel:
Data model
==========
Datamodel
=========
.. _sec-api-slicing-datamodel-slicerlist:
@@ -264,14 +263,9 @@ Slicer
- ``string``
- Identifier of the slicer
* - ``displayName``
- 1
- 0..1
- ``string``
- Display name of the slicer
* - ``sameDevice``
- 1
- ``boolean``
- Whether the slicer runs on the same device as OctoPrint (``true``) and hence can't be used while printing,
or not (``false``)
* - ``default``
- 1
- ``boolean``
-242
View File
@@ -1,242 +0,0 @@
.. _sec-api-system:
******
System
******
.. note::
All system operations require admin rights.
.. _sec-api-system-command-list:
List all registered system commands
===================================
.. http:get:: /api/system/commands
Retrieves all configured system commands.
A :http:statuscode:`200` with a :ref:`List all response <sec-api-system-commands-listall>`
will be returned.
**Example**
.. sourcecode:: http
GET /api/system/commands/core HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 Ok
Content-Type: application/json
{
"core": [
{
"action": "shutdown",
"name": "Shutdown",
"command": "sudo shutdown -h now",
"confirm": "<strong>You are about to shutdown the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"source": "core",
"resource": "http://example.com/api/system/commands/core/shutdown"
},
{
"action": "reboot",
"name": "Reboot",
"command": "sudo reboot",
"confirm": "<strong>You are about to reboot the system.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"source": "core",
"resource": "http://example.com/api/system/commands/core/reboot"
},
{
"action": "restart",
"name": "Restart OctoPrint",
"command": "sudo service octoprint restart",
"confirm": "<strong>You are about to restart the OctoPrint server.</strong></p><p>This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"source": "core",
"resource": "http://example.com/api/system/commands/core/restart"
}
],
"custom": []
}
:statuscode 200: No error
.. _sec-api-system-command-listsource:
List all registered system commands for a source
================================================
.. http:get:: /api/system/commands/(string:source)
Retrieves the configured system commands for the specified source.
The response will contain a list of :ref:`command definitions <sec-api-system-commands-definiton>`.
**Example**
.. sourcecode:: http
GET /api/system/commands/core HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 Ok
Content-Type: application/json
[
{
"action": "shutdown",
"name": "Shutdown",
"command": "sudo shutdown -h now",
"confirm": "<b>You are about to shutdown the system.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"source": "core",
"resource": "http://example.com/api/system/commands/core/shutdown"
},
{
"action": "reboot",
"name": "Reboot",
"command": "sudo reboot",
"confirm": "<b>You are about to reboot the system.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"source": "core",
"resource": "http://example.com/api/system/commands/core/reboot"
},
{
"action": "restart",
"name": "Restart OctoPrint",
"command": "sudo service octoprint restart",
"confirm": "<b>You are about to restart the OctoPrint server.</b></p><p> This action may disrupt any ongoing print jobs (depending on your printer's controller and general setup that might also apply to prints run directly from your printer's internal storage).",
"async": true,
"ignore": true,
"source": "core",
"resource": "http://example.com/api/system/commands/core/restart"
}
]
:param source: The source for which to list commands, currently either ``core`` or ``custom``
:statuscode 200: No error
:statuscode 404: If a ``source`` other than ``core`` or ``custom`` is specified.
.. _sec-api-system-command-execute:
Execute a registered system command
===================================
.. http:post:: /api/system/commands/(string:source)/(string:action)
Execute the system command ``action`` defined in ``source``.
**Example**
Restart OctoPrint via the core system command ``restart`` (which is available if the server
restart command is configured).
.. sourcecode:: http
POST /api/system/commands/core/restart HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 204 No Content
:param source: The source for which to list commands, currently either ``core`` or ``custom``
:param action: The identifier of the command, ``action`` from its definition
:statuscode 204: No error
:statuscode 400: If a ``divider`` is supposed to be executed or if the request is malformed otherwise
:statuscode 404: If the command could not be found for ``source`` and ``action``
:statuscode 500: If the command didn't define a ``command`` to execute, the command returned a non-zero
return code and ``ignore`` was not ``true`` or some other internal server error occurred
.. _sec-api-system-datamodel:
Data model
==========
.. _sec-api-system-commands-listall:
List all response
-----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``core``
- 0..n
- List of :ref:`command definitions <sec-api-system-commands-definiton>`
- List of all core commands defined.
* - ``custom``
- 0..n
- List of :ref:`command definitions <sec-api-system-commands-definiton>`
- List of all custom commands defined in ``config.yaml``.
.. _sec-api-system-commands-definiton:
Command definition
------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The name of the command to display in the System menu.
* - ``command``
- 1
- string
- The full command line to execute for the command.
* - ``action``
- 1
- string
- An identifier to refer to the command programmatically. The special ``action`` string
``divider`` signifies a divider in the menu.
* - ``confirm``
- 0..1
- string
- If present and set, this text will be displayed to the user in a confirmation dialog
they have to acknowledge in order to really execute the command.
* - ``async``
- 0..1
- bool
- Whether to execute the command asynchronously or wait for its result before responding
to the HTTP execution request.
* - ``ignore``
- 0..1
- bool
- Whether to ignore the return code of the command's execution.
* - ``source``
- 1
- string
- Source of the command definition, currently either ``core`` (for system actions defined by
OctoPrint itself) or ``custom`` (for custom system commands defined by the user through ``config.yaml``).
* - ``resource``
- 1
- string
- The URL of the command to use for executing it.
-255
View File
@@ -1,255 +0,0 @@
.. _sec-api-timelapse:
*********
Timelapse
*********
.. contents::
.. _sec-api-timelapse-list:
Retrieve a list of timelapses and the current config
====================================================
.. http:get:: /api/timelapse
Retrieves a list of timelapses and the current config.
Returns a :ref:`timelapse list <sec-api-timelapse-datamodel-list>` in the
response body.
:param unrendered: If provided and true, also include unrendered timelapses
.. _sec-api-timelapse-delete:
Delete a timelapse
==================
.. http:delete:: /api/timelapse/(string:filename)
Delete the timelapse ``filename``.
Requires user rights.
.. _sec-api-timelapse-render:
Issue a command for an unrendered timelapse
===========================================
.. http:post:: /api/timelapse/unrendered/(string:name)
Current only supports to render the unrendered timelapse ``name`` via the
``render`` command.
Requires user rights.
:json command: The command to issue, currently only ``render`` is supported
.. _sec-api-timelapse-delete-unrendered:
Delete an unrendered timelapse
==============================
.. http:delete:: /api/timelapse/unrendered/(string:name)
Delete the unrendered timelapse ``name``.
Requires user rights.
.. _sec-api-timelapse-saveconfig:
Change current timelapse config
===============================
.. http:post:: /api/timelapse
Save a new :ref:`timelapse configuration <sec-api-timelapse-datamodel-config>` to use for the next print.
The configuration is expected as the request body.
Requires user rights.
.. _sec-api-timelapse-datamodel:
Data model
==========
.. _sec-api-timelapse-datamodel-list:
Timelapse list
--------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``config``
- 1
- :ref:`Timelapse config <sec-api-timelapse-datamodel-config>`
- Current timelapse configuration
* - ``files``
- 0..*
- List of :ref:`rendered timelapses <sec-api-timelapse-datamodel-rendered>`
- List of rendered timelapse entries
* - ``unrendered``
- 0..*
- List of :ref:`unrendered timelapses <sec-api-timelapse-datamodel-unrendered>`
- List of unrendered timelapse entries, only present if requested
.. _sec-api-timelapse-datamodel-rendered:
Rendered timelapse
------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- Name of the timelapse file
* - ``size``
- 1
- string
- Formatted size of the timelapse file
* - ``bytes``
- 1
- int
- Size of the timelapse file in bytes
* - ``date``
- 1
- string
- Formatted timestamp of the timelapse creation date
* - ``url``
- 1
- string
- URL for downloading the timelapse
.. _sec-api-timelapse-datamodel-unrendered:
Unrendered timelapse
--------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- Name of the unrendered timelapse job
* - ``size``
- 1
- string
- Formatted size of all files in the unrendered timelapse job
* - ``bytes``
- 1
- int
- Size of all files in the unrendered timelapse job in bytes
* - ``date``
- 1
- string
- Formatted timestamp of the timelapse job creation date
* - ``recording``
- 1
- bool
- Whether the timelapse is still being recorded (true) or not (false)
* - ``rendering``
- 1
- bool
- Whether the timelapse is still being rendered (true) or not (false)
* - ``processing``
- 1
- bool
- Whether the timelapse is either still being recorded or rendered (true) or not (false)
.. _sec-api-timelapse-datamodel-config:
Timelapse configuration
-----------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``type``
- 1
- string
- Type of the timelapse, either ``off``, ``zchange`` or ``timed``.
Further fields are timelapse type specific, see below for details.
.. _sec-api-timelapse-datamodel-config-off:
Z-change-triggered timelapse
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For timelapse type ``zchange``.
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``postRoll``
- 1
- int
- Configured post roll in seconds
* - ``fps``
- 1
- int
- Frames per second to use for rendered video
* - ``retractionZHop``
- 1
- float
- Size of retraction Z hop to detect and ignore for z-based snapshots
.. _sec-api-timelapse-datamodel-config-timed:
Time triggered timelapse
~~~~~~~~~~~~~~~~~~~~~~~~
For timelapse type ``timed``.
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``postRoll``
- 1
- int
- Configured post roll in seconds
* - ``fps``
- 1
- int
- Frames per second to use for rendered video
* - ``interval``
- 1
- int
- Seconds between individual shots
-314
View File
@@ -1,314 +0,0 @@
.. _sec-api-user:
****
User
****
.. contents::
.. _sec-api-users-list:
Retrieve a list of users
========================
.. http:get:: /api/users
Retrieves a list of all registered users in OctoPrint.
Will return a :http:statuscode:`200` with a :ref:`user list response <sec-api-users-datamodel-userlistresponse>`
as body.
Requires admin rights.
:status 200: No error
.. _sec-api-users-retrieve:
Retrieve a user
===============
.. http:get:: /api/users/(string:username)
Retrieves information about a user.
Will return a :http:statuscode:`200` with a :ref:`user record <sec-api-users-datamodel-userrecord>`
as body.
Requires either admin rights or to be logged in as the user.
:param username: Name of the user which to retrieve
:status 200: No error
:status 404: Unknown user
.. _sec-api-users-add:
Add a user
==========
.. http:post:: /api/users
Adds a user to OctoPrint.
Expects a :ref:`user registration request <sec-api-users-datamodel-adduserrequest>`
as request body.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
Requires admin rights.
:json name: The user's name
:json password: The user's password
:json active: Whether to activate the account (true) or not (false)
:json admin: Whether to give the account admin rights (true) or not (false)
:status 200: No error
:status 400: If any of the mandatory fields is missing or the request is otherwise
invalid
:status 409: A user with the provided name does already exist
.. _sec-api-users-update:
Update a user
=============
.. http:put:: /api/users/(string:username)
Updates a user record.
Expects a :ref:`user update request <sec-api-users-datamodel-updateuserrequest>`
as request body.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
Requires admin rights.
:param username: Name of the user to update
:json admin: Whether to mark the user as admin (true) or not (false), can be left out (no change)
:json active: Whether to mark the account as activated (true) or deactivated (false), can be left out (no change)
:status 200: No error
:status 404: Unknown user
.. _sec-api-users-delete:
Delete a user
=============
.. http:delete:: /api/users/(string:username)
Delete a user record.
Returns a list of registered users on success, see :ref:`Retrieve a list of users <sec-api-users-list>`.
Requires admin rights.
:param username: Name of the user to delete
:status 200: No error
:status 404: Unknown user
.. _sec-api-users-resetpassword:
Reset a user's password
=======================
.. http:put:: /api/users/(string:username)/password
Changes the password of a user.
Expects a JSON object with a single property ``password`` as request body.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to change the password for
:json password: The new password to set
:status 200: No error
:status 400: If the request doesn't contain a ``password`` property or the request
is otherwise invalid
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-getsettings:
Retrieve a user's settings
==========================
.. http:get:: /api/users/(string:username)/settings
Retrieves a user's settings.
Will return a :http:statuscode:`200` with a JSON object representing the user's
personal settings (if any) as body.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 200: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-updatesettings:
Update a user's settings
========================
.. http:patch:: /api/users/(string:username)/settings
Updates a user's settings.
Expects a new settings JSON object to merge with the current settings as
request body.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 204: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-generateapikey:
Regenerate a user's personal API key
====================================
.. http:post:: /api/users/(string:username)/apikey
Generates a new API key for the user.
Does not expect a body. Will return the generated API key as ``apikey``
property in the JSON object contained in the response body.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 200: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-deleteapikey:
Delete a user's personal API key
================================
.. http:delete:: /api/users/(string:username)/apikey
Deletes a user's personal API key.
Requires admin rights or to be logged in as the user.
:param username: Name of the user to retrieve the settings for
:status 204: No error
:status 403: No admin rights and not logged in as the user
:status 404: The user is unknown
.. _sec-api-users-datamodel:
Data model
==========
.. _sec-api-users-datamodel-userlistresponse:
User list response
------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``users``
- 0..n
- List of :ref:`user records <sec-api-users-datamodel-userrecord>`
- The list of registered users
.. _sec-api-users-datamodel-userrecord:
User record
-----------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The user's name
* - ``active``
- 1
- bool
- Whether the user's account is active (true) or not (false)
* - ``user``
- 1
- bool
- Whether the user has user rights. Should always be true.
* - ``admin``
- 1
- bool
- Whether the user has admin rights (true) or not (false)
* - ``apikey``
- 0..1
- string
- The user's personal API key
* - ``settings``
- 1
- object
- The user's personal settings, might be an empty object.
.. _sec-api-users-datamodel-adduserrequest:
User registration request
-------------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- string
- The user's name
* - ``password``
- 1
- string
- The user's password
* - ``active``
- 1
- bool
- Whether to activate the account (true) or not (false)
* - ``admin``
- 0..1
- bool
- Whether to give the user admin rights (true) or not (false or not present)
.. _sec-api-users-datamodel-updateuserrequest:
User update request
-------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``active``
- 0..1
- bool
- If present will set the user's active flag to the provided value. True for
activating the account, false for deactivating it.
* - ``admin``
- 0..1
- bool
- If present will set the user's admin flag to the provided value. True for
admin rights, false for no admin rights.
-411
View File
@@ -1,411 +0,0 @@
.. _sec-api-util:
****
Util
****
.. _sec-api-util-test:
Test paths or URLs
==================
.. http:post:: /api/util/test
Provides commands to test paths or URLs for correctness.
Used by OctoPrint to validate paths or URLs that the user needs to enter in the
settings.
The following commands are supported at the moment:
.. _sec-api-util-test-path:
path
Tests whether or provided path exists and optionally if it also is either a file
or a directory and whether OctoPrint's user has read, write and/or execute permissions
on it. Supported parameters are:
* ``path``: The file system path to test. Mandatory.
* ``check_type``: ``file`` or ``dir`` if the path should not only be checked for
existence but also whether it is of the specified type. Optional.
* ``check_access``: A list of any of ``r``, ``w`` and ``x``. If present it will also
be checked if OctoPrint has read, write, execute permissions on the specified path.
* ``allow_create_dir``: If ``check_type`` is provided and set to ``dir``, this will allow
OctoPrint to create the target ``path`` as a directory if it doesn't yet exist to allow
for further tests.
* ``check_writable_dir``: If ``check_type`` is provided and set to ``dir``, this will
check that the provided ``path`` is a writable directory. OctoPrint not only check if the
permissions on the directory allow for writing but also attempt to write (and delete) a
small test file ``.testballoon.txt`` to the directory to test if writing is actually
possible.
The ``path`` command returns a :http:statuscode:`200` with a :ref:`path test result <sec-api-util-datamodel-pathtestresult>`
when the test could be performed. The status code of the response does NOT reflect the
test result!
.. _sec-api-util-test-url:
url
Tests whether a provided URL responds. Request method and expected status codes can
optionally be specified as well. Supported parameters are:
* ``url``: The URL to test. Mandatory.
* ``method``: The request method to use for the test. Optional, defaults to ``HEAD``.
* ``timeout``: A timeout for the request, in seconds. If no reply from the tested URL has been
received within this time frame, the check will be considered a failure. Optional, defaults to 3 seconds.
* ``validSsl``: Whether to validate the SSL connection if the ``url`` happens to be an HTTPS URL or not. Optional,
defaults to ``True``.
* ``status``: The status code(s) or named status range(s) to test for. Can be either a single
value or a list of either HTTP status codes or any of the following named status ranges:
* ``informational``: Status codes from 100 to 199
* ``success``: Status codes from 200 to 299
* ``redirection``: Status codes from 300 to 399
* ``client_error``: Status codes from 400 to 499
* ``server_error``: Status codes from 500 to 599
* ``normal``: Status codes from 100 to 399
* ``error``: Status codes from 400 to 599
* ``any``: Any status code starting from 100
The test will past the status code check if the status returned by the URL is within any of
the specified ranges.
* ``response``: If set to either ``true``, ``json`` or ``bytes``, the response body and the response headers
from the URL check will be returned as part of the check result as well. ``json`` will attempt
to parse the response as json and return the parsed result. ``true`` or ``bytes`` will base64 encode the body
and return that.
* ``content_type_whitelist``: Optional array of supported content types. If set and the URL returns a content
type not included in this list, the test will fail. E.g. ``["image/*", "text/plain"]``.
* ``content_type_blacklist``: Optional array of unsupported content types. If set and the URL returns a content
type included in this list, the test wil fail. E.g. ``["video/*"]``. Can be used together with ``content_type_whitelist``
to further limit broader content type definition, e.g. by putting ``image/*`` into the whitelist, but disallowing
PNG by including ``image/png`` on the blacklist.
The ``url`` command returns :http:statuscode:`200` with a :ref:`URL test result <sec-api-util-datamodel-urltestresult>`
when the test could be performed. The status code of the response does NOT reflect the
test result!
.. _sec-api-util-test-server:
server
Tests whether a provided server identified by host and port can be reached. Protocol can optionally be specified
as well. Supported parameters are:
* ``host``: The host to test. IP or host name. Mandatory.
* ``port``: The port to test. Integer. Mandatory.
* ``protocol``: The protocol to test with. ``tcp`` or ``udp``. Optional, defaults to ``tcp``.
* ``timeout``: A timeout for the test, in seconds. If no successful connection to the server could be established
within this time frame, the check will be considered a failure. Optional, defaults to 3.05 seconds.
The ``server`` command returns :http:statuscode:`200` with a :ref:`Server test result <sec-api-util-datamodel-servertestresult>`
when the test could be performed. The status code of the response does NOT reflect the test result!
Requires admin rights.
**Example 1**
Test whether a path exists and is a file readable and executable by OctoPrint.
.. sourcecode:: http
POST /api/util/test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"command": "path",
"path": "/some/path/to/a/file",
"check_type": "file",
"check_access": ["r", "x"]
}
.. sourcecode:: HTTP
HTTP/1.1 200 OK
Content-Type: application/json
{
"path": "/some/path/to/a/file",
"exists": true,
"typeok": true,
"access": true,
"result": true
}
**Example 2**
Test whether a path exists which doesn't exist.
.. sourcecode:: http
POST /api/util/test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"command": "path",
"path": "/some/path/to/a/missing_file",
"check_type": "file",
"check_access": ["r", "x"]
}
.. sourcecode:: HTTP
HTTP/1.1 200 OK
Content-Type: application/json
{
"path": "/some/path/to/a/missing_file",
"exists": false,
"typeok": false,
"access": false,
"result": false
}
**Example 3**
Test whether a path exists and is a file which is a directory.
.. sourcecode:: http
POST /api/util/test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"command": "path",
"path": "/some/path/to/a/folder",
"check_type": "file"
}
.. sourcecode:: HTTP
HTTP/1.1 200 OK
Content-Type: application/json
{
"path": "/some/path/to/a/folder",
"exists": true,
"typeok": false,
"access": true,
"result": false
}
**Example 4**
Test whether a URL returns a normal status code for a HEAD request.
.. sourcecode:: http
POST /api/util/test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"command": "url",
"url": "http://example.com/some/url"
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"url": "http://example.com/some/url",
"status": 200,
"result": true
}
**Example 5**
Test whether a URL can be called at all via GET request, provide its raw body. Set a timeout of 1s.
.. sourcecode:: http
POST /api/util/test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"command": "url",
"url": "http://example.com/some/url",
"method": "GET",
"timeout": 1.0,
"status": "any",
"response": true
}
.. sourcecode:: HTTP
HTTP/1.1 200 OK
Content-Type: application/json
{
"url": "http://example.com/some/url",
"status": 200,
"result": true,
"response": {
"headers": {
"content-type": "image/gif"
},
"content": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
}
}
**Example 6**
Test whether a server is reachable on a given port via TCP.
.. sourcecode:: http
POST /api/util/test HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
Content-Type: application/json
{
"command": "server",
"host": "8.8.8.8",
"port": 53
}
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"host": "8.8.8.8",
"port": 53,
"protocol": "tcp",
"result": true
}
:json command: The command to execute, currently either ``path`` or ``url``
:json path: ``path`` command only: the path to test
:json check_type: ``path`` command only: the type of path to test for, either ``file`` or ``dir``
:json check_access: ``path`` command only: a list of access permissions to check for
:json allow_create_dir: ``path`` command and ``checktype`` of ``dir`` only: whether to allow creation of the
directory if it doesn't yet exist (``true``) or not (``false``, default)
:json check_writable_dir: ``path`` command and ``checktype`` of ``dir`` only: whether to test if the directory
is writable by also trying to create a test file in it (``true``) or not (``false``, default)
:json url: ``url`` command only: the URL to test
:json status: ``url`` command only: one or more expected status codes
:json method: ``url`` command only: the HTTP method to use for the check
:json timeout: ``url`` and ``server`` commands only: the timeout for the test request
:json response: ``url`` command only: whether to include response data and if so in what form
:json host: ``server`` command only: the server to test
:json port: ``server`` command only: the port to test
:json protocol: ``server`` command only: the protocol to test
:statuscode 200: No error occurred
.. _sec-api-util-datamodel:
Data model
==========
.. _sec-api-util-datamodel-pathtestresult:
Path test result
----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``path``
- 1
- string
- The path that was tested.
* - ``exists``
- 1
- bool
- ``true`` if the path exists, ``false`` otherwise.
* - ``typeok``
- 1
- bool
- ``true`` if a type check was not requested or it passed, ``false`` otherwise
* - ``access``
- 1
- bool
- ``true`` if a permission check was not requested or it passed, ``false`` otherwise
* - ``result``
- 1
- bool
- ``true`` if the overall check passed, ``false`` otherwise
.. _sec-api-util-datamodel-urltestresult:
URL test result
---------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``url``
- 1
- string
- The URL that was tested.
* - ``status``
- 1
- int
- The status code returned by the URL, 0 in case of a timeout.
* - ``result``
- 1
- bool
- ``true`` if the check passed.
* - ``response``
- 0..1
- string or object
- If ``response`` in the request was set to ``bytes``: The base64 encoded body of the checked URL's response.
If ``response`` in the request was set to ``json``: The json decoded body of the checked URL's response.
Not present if ``response`` in the request was not set.
* - ``headers``
- 0..1
- object
- A dictionary with all headers of the checked URL's response. Only present if ``response`` in the
request was set.
.. _sec-api-util-datamodel-servertestresult:
Server test result
------------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``host``
- 1
- string
- The host that was tested.
* - ``port``
- 1
- int
- The port that was tested
* - ``protocol``
- 1
- string
- The protocol that was tested, ``tcp`` or ``udp``
* - ``result``
- 1
- bool
- ``true`` if the check passed.
+2 -4
View File
@@ -7,8 +7,7 @@ Version information
.. http:get:: /api/version
Retrieve information regarding server and API version. Returns a JSON object with two keys, ``api`` containing
the API version, ``server`` containing the server version, ``text`` containing the server version including
the prefix ``OctoPrint `` (to determine that this is indeed a genuine OctoPrint instance).
the API version, ``server`` containing the server version.
**Example Request**
@@ -27,8 +26,7 @@ Version information
{
"api": "0.1",
"server": "1.3.10",
"text": "OctoPrint 1.3.10"
"server": "1.1.0"
}
:statuscode 200: No error
-75
View File
@@ -1,75 +0,0 @@
.. _sec-api-wizard:
******
Wizard
******
.. note::
All wizard operations require either admin rights or the ``firstRun`` flag to be ``true``.
.. contents::
.. _sec-api-wizard-retrieve:
Retrieve additional data about registered wizards
=================================================
.. http:get:: /setup/wizard
Retrieves additional data about the registered wizards.
Returns a :http:statuscode:`200` with an object mapping wizard identifiers to :ref:`wizard data entries <sec-api-wizard-datamodel-wizarddata>`.
.. _sec-api-wizard-finish:
Finish wizards
==============
.. http:post:: /setup/wizard
Inform wizards that the wizard dialog has been finished.
Expects a JSON request body containing a property ``handled`` which holds a list of wizard identifiers
which were handled (not skipped) in the wizard dialog.
Will call :func:`octoprint.plugin.WizardPlugin.on_wizard_finish` for all registered wizard plugins,
supplying the information whether the wizard plugin's identifier was within the list of ``handled``
wizards or not.
:json handled: A list of handled wizards
.. _sec-api-wizard-datamodel:
Data model
==========
.. _sec-api-wizard-datamodel-wizarddata:
Wizard data entry
-----------------
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``required``
- 1
- bool
- Whether the wizard needs to be run (true) or not (false)
* - ``details``
- 1
- object
- Details for the wizard's UI provided by the wizard plugin
* - ``version``
- 1
- int or null
- Version of the wizard
* - ``ignored``
- 1
- bool
- Whether the wizard has already been seen/is ignored (true) or not (false)
@@ -1,110 +0,0 @@
.. _sec-bundledplugins-action_command_prompt:
Action Command Prompt support
=============================
The OctoPrint Action Command Prompt Support Plugin comes bundled with OctoPrint (starting with 1.3.9).
It allows firmware to trigger dialog prompts for logged in users using :ref:`action commands <sec-features-action_commands>`, e.g. to wait
for user acknowledgement or allow the user to choose between options, and also to close the dialog again
in case its no longer needed, e.g. due to the user proceeding on the printer's own controller.
The choice of the user can be communicated back to the firmware via a configurable GCODE command with a
placeholder for the selected option's index.
.. _fig-bundledplugins-action_command_prompt-example:
.. figure:: ../images/bundledplugins-action_command_prompt-example.png
:align: center
:alt: Simple prompt example
A simple dialog example triggered by the firmware
.. _sec-bundledplugins-action_command_prompt-firststeps:
First Steps
-----------
In order for this plugin to work, you'll need to configure it with the command your firmware uses to accept
dialog selections. You can do that in the settings dialog.
Currently there is no agreed upon command for this since no firmware has yet made use of this feature, so OctoPrint
ships with an empty value here.
.. _sec-bundledplugins-action_command_prompt-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``selection_command``: The command to send to the firmware on choice, including the ``{choice}`` placeholder, e.g. ``M876 S{choice}``.
You can modify them either through the plugin's configuration dialog under Settings, or by directly editing ``config.yaml``.
.. _sec-bundledplugins-action_command_prompt-action_commands:
Supported action commands
-------------------------
prompt_begin <message>
Starts the definition of a prompt dialog. ``<message>`` is the message to display to the user. Will be ignored
if a dialog is already defined.
prompt_choice <text>
Defines a choice with the associated ``<text>``. Will be ignored if no dialog has been defined yet.
prompt_button <text>
Same as ``prompt_choice``.
prompt_show
Tells OctoPrint that the dialog is now fully defined and to prompt the user. Will be ignored if no dialog is
defined yet.
prompt_end
Tells OctoPrint that the dialog should now be closed (e.g. the user made the choice on the printer directly instead
of through OctoPrint). Will be ignored if no dialog is defined yet.
.. _sec-bundledplugins-action_command_prompt-example:
Example communication with the firmware
---------------------------------------
.. _sec-bundledplugins-action_command_prompt-sourcecode:
To display the :ref:`above dialog <fig-bundledplugins-action_command_prompt-example>` the firmware sent these action commands:
.. code-block:: none
//action:prompt_begin Filament unloaded, swap then proceed
//action:prompt_choice Filament swapped
//action:prompt_show
If the user clicks the button, assuming a ``selection_command`` of ``M876 S{choice}`` is configured, OctoPrint
will send back ``M876 S0`` (0-based index).
A more complicated example with three options would be the following:
.. code-block:: none
//action:prompt_begin Filament runout detected. Please choose how to proceed:
//action:prompt_choice Swap filament
//action:prompt_choice Home X/Y and pause print
//action:prompt_choice Abort print
//action:prompt_show
This would produce the following output:
.. _fig-bundledplugins-action_command_prompt-example2:
.. figure:: ../images/bundledplugins-action_command_prompt-example2.png
:align: center
:alt: Another prompt example
Another dialog example triggered by the firmware
If the user selects "Abort print", OctoPrint will send ``2`` as selected choice.
Source code
-----------
The source of the Action Command Prompt Support plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/action_command_prompt``.
-67
View File
@@ -1,67 +0,0 @@
.. _sec-bundledplugins-announcements:
Announcement Plugin
===================
The OctoPrint Announcement Plugin comes bundled with OctoPrint (starting with 1.2.11).
It displays announcements fetched from OctoPrint's websites, such as important updates, release announcements, new
plugins and similar. Through some manual configuration via ``config.yaml`` it also allows adding additional channels
via RSS or Atom feed URLs.
.. _fig-bundledplugins-announcements-example1:
.. figure:: ../images/bundledplugins-announcements-example1.png
:align: center
:alt: Example notification
An example notification from the Announcement Plugin.
.. _fig-bundledplugins-announcements-example2:
.. figure:: ../images/bundledplugins-announcements-example2.png
:align: center
:alt: Announcement reader
The Announcement Plugin's reader dialog.
.. _fig-bundledplugins-announcements-settings:
.. figure:: ../images/bundledplugins-announcements-settings.png
:align: center
:alt: Announcement settings
The Announcement Plugin's settings dialog.
.. _sec-bundledplugins-announcements-configuration:
Configuring the plugin
----------------------
The plugin allows enabling and disabling the preconfigured announcement channels via its settings dialog.
On top of that it's possible to add additional announcement channels (as RSS or Atom feed URLs) or change the
configuration of the existing channels through ``config.yaml``.
The available configuration keys are:
* ``channels``: Configured announcement channels. A mapping from a unique identifier to a configuration structure
that follows this format:
* ``name``: Name of the channel, used e.g. in the title of the displayed notifications.
* ``description``: Description of the channel.
* ``priority``: ``1`` for high priority announcements (red notification), ``2`` for regular ones (yellow notification).
* ``type``: Currently unused.
* ``url``: URL for the feed acting as notification source, must be RSS or Atom format.
* ``enabled_channels``: List of identifiers of enabled channels.
* ``forced_channels``: List of identifiers of channels that cannot be disabled (currently only ``_important`` which is used sparingly).
* ``channel_order``: List of channel identifiers in the order they should appear in the UI.
* ``ttl``: Time to live of the channel cache in minutes (default: 6 hours).
* ``display_limit``: Limit of items to display per channel (default: 3).
* ``summary_limit``: Limit of characters to display from each channel entry (default: 300).
.. _sec-bundledplugins-announcements-sourcecode:
Source code
-----------
The source of the Announcement plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/announcements``.
-543
View File
@@ -1,543 +0,0 @@
.. _sec-bundledplugins-appkeys:
Application Keys Plugin
=======================
The OctoPrint Application Keys Plugin comes bundled with OctoPrint (starting with version 1.3.10).
It implements a workflow for third party apps or clients to obtain an application specific API key from OctoPrint to interact with it
on a user's behalf, via confirmation of the user through OctoPrint's web interface. Existing keys can be managed
on a per-user base as well as globally by administrators.
.. _fig-bundledplugins-appkeys-confirmation:
.. figure:: ../images/bundledplugins-appkeys-confirmation_prompt.png
:align: center
:alt: Confirmation
The plugin's confirmation generated for a new application key request.
.. _fig-bundledplugins-appkeys-user_settings:
.. figure:: ../images/bundledplugins-appkeys-user_settings.png
:align: center
:alt: Key management via user settings
Users can manage the application specific API keys registered to their account via their user settings.
.. _fig-bundledplugins-appkeys-settings:
.. figure:: ../images/bundledplugins-appkeys-settings.png
:align: center
:alt: Global key management via settings
Administrators can manage all application specific API keys registered to any user.
.. _sec-bundledplugins-appkeys-workflow:
Workflow
--------
The workflow to receive an API key for a third party client/an app via the Application Keys Plugin should consist
of the following steps:
1. The User opens the App and gets prompted to enter or select an instance URL. Optionally (recommended!) the User also
enters their username which is also their user ID into the App.
2. The App :ref:`probes for workflow support <sec-bundledplugins-appkeys-api-probe>` on the Server. If this request
doesn't get an HTTP :http:statuscode:`204` the App needs to direct the user to an alternative manual workflow
(copy-paste API key) and abort this one. Otherwise it proceeds to the next step.
3. The App sends a :ref:`key request <sec-bundledplugins-appkey-datamodel-keyrequest>` to the Server to start the
authorization process.
4. The Server triggers a confirmation dialog for the User on the Webinterface and returns an endpoint to the
App to poll for a decision in the ``Location`` header of an HTTP :http:statuscode:`201`.
5. The App uses the obtained request specific endpoint to poll for a decision every second. An HTTP :http:statuscode:`202`
signals that no decision has been made yet.
6. The User either accepts or denies the access request which makes the Webinterface send a
:ref:`decision request <sec-bundledplugins-appkey-datamodel-decisionrequest>` to the Server.
7. If the User accepted the request, the App receives an HTTP :http:statuscode:`200` with an attached
:ref:`API key response <sec-bundledplugins-appkey-datamodel-keyresponse>`. If they deny it, the App will receive
an HTTP :http:statuscode:`404`.
.. mermaid::
sequenceDiagram
participant User
participant App
participant Webinterface
participant Server
note over User, Server: Step 1, 2 & 3
User->>App: enters URL of instance to connect to and optional user_id
App->>Server: GET /plugin/appkeys/probe
alt Workflow unsupported
Server->>App: 404
App->>User: alternative workflow, copy-paste key manually
else Workflow supported
App->>Server: POST /plugin/appkeys/request, (app_name, user_id)
note over User, Server: Step 4
Server-->>Webinterface: plugin message for "appkeys" w/ (app_name, user_token, user_id)
Webinterface-->>User: Display confirmation dialog
Server->>App: 201, Location: /plugin/appkeys/request/<app_token>
note over User, Server: Step 5
loop Poll for decision
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 202
end
note over User, Server: Step 6 & 7
alt User accepts
User-->>Webinterface: Allow access
Webinterface->>Server: POST /plugin/appkeys/decision/<user_token>, (True)
Server->>Webinterface: 204
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 200, api_key
else User denies
User-->>Webinterface: Deny access
Webinterface->>Server: POST /plugin/appkeys/decision/<user_token>, (False)
Server->>Webinterface: 204
App->>Server: GET /plugin/appkeys/request/<app_token>
Server->>App: 404
end
end
.. _sec-bundledplugins-appkeys-api:
API
---
.. _sec-bundledplugins-appkeys-api-probe:
Probe for workflow support
..........................
.. http:get:: /plugin/appkeys/probe
Probes for support of the workflow.
Normally returns an HTTP :http:statuscode:`204`, indicating workflow availability. If a different status code is returned
(usually an HTTP :http:statuscode:`404`), the plugin is disabled or not installed. Fall back to manual api key exchange.
:status 204: the workflow is supported
.. _sec-bundledplugins-appkeys-api-startauthprocess:
Start authorization process
...........................
.. http:post:: /plugin/appkeys/request
Starts the authorization process.
Expects a :ref:`Key request <sec-bundledplugins-appkey-datamodel-keyrequest>` as request body.
The ``app`` parameter should be a human readable identifier to use
for the application requesting access. It will be displayed to the user. Internally it will be used case insensitively,
so ``My App`` and ``my APP`` are considered the same application identifiers.
The optional ``user`` parameter should be used to limit the authorization process to a specified user. If the parameter
is left unset, any user will be able to complete the authorization process and grant access to the app with their
account. E.g. if a user ``me`` starts the process in an app, the app should request that name from the user and use
it in the ``user`` parameter. OctoPrint will then only display the authorization request on browsers the user ``me``
is logged in on.
:json app: application identifier to use for the request, case insensitive
:json user: optional user id to restrict the decision to the specified user
:status 201: authorization process started, polling URL to query can be found in ``Location`` header
.. _sec-bundledplugins-appkeys-api-polldecision:
Poll for decision on existing request
.....................................
.. http:get:: /plugin/appkeys/request/<str:app_token>
Endpoint generated per authorization request to poll for the result.
Returns an HTTP :http:statuscode:`202` while no decision has been made yet, an HTTP :http:statuscode:`200` and
a :ref:`Key response <sec-bundledplugins-appkey-datamodel-keyresponse>` if access has been granted and an
HTTP :http:statuscode:`404` if the request has been denied or timed out.
.. note::
The request will be considered stale and deleted internally if the polling endpoint for it isn't called
for more than 5s.
:status 200: access granted, API key in response body
:status 202: no decision has been made yet, continue polling
:status 404: access denied or request timed out
.. _sec-bundledplugins-appkeys-api-decide:
Decide on existing request
..........................
.. http:post:: /plugin/appkeys/decision/<str:user_token>
Endpoint to decide on the authorization request.
Expects a :ref:`Decision request <sec-bundledplugins-appkey-datamodel-decisionrequest>` as request body.
Returns an HTTP :http:statuscode:`204` on success.
:json decision: boolean value to indicate whether to confirm (``True``) or deny (``False``) access
:status 204: success
.. _sec-bundledplugins-appkeys-api-fetchlist:
Fetch list of existing application keys
.......................................
.. http:get:: /api/plugin/appkeys
Fetches a list of existing application keys and pending requests registered in the system for the current user.
If the additional optional parameter ``all`` is provided and the user has administrator rights, fetches a list
of *all** application keys and pending requests registered in the system for any user.
Returns a :http:statuscode:`200` with a :ref:`List response <sec-bundledplugins-appkey-datamodel-listreponse>` in the
body upon success.
:query all: Fetch all application keys and pending requests from all users. Requires administrator rights.
.. _sec-bundledplugins-appkeys-api-issuecommand:
Issue an application key command
................................
.. http:post:: /api/plugin/appkeys
Application key commands allow revoking existing application keys and manually generating new ones. The available
commands are:
revoke
Revokes an existing application key. Must belong to the user issuing the command, unless the user has admin rights
in which case they make revoke any application key in the system. Expects the key in question as parameter ``key``.
generate
Generates a new application key for the user, using the application identifier provided as parameter ``app``.
Upon success, a status code of :http:statuscode:`204` and an empty body is returned.
Requires user rights.
**Example revoke request**
Revokes the (fictional) key ``aabbccddeeff112233445566``.
.. sourcecode:: http
POST /api/plugin/appkeys HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "revoke",
"key": "aabbccddeeff112233445566"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
**Example generate request**
Generates a new key for application identifier "My awesome application 1.0".
.. sourcecode:: http
POST /api/plugin/appkeys HTTP/1.1
Host: example.com
Content-Type: application/json
X-Api-Key: abcdef...
{
"command": "generate",
"key": "My awesome application 1.0"
}
.. sourcecode:: http
HTTP/1.1 204 No Content
:json string command: The command to issue, either ``revoke`` or ``generate``
:json string key: ``revoke`` command: The key to revoke
:json string app: ``generate`` command: Application identifier for which to generate a key
:statuscode 204: No error
:statuscode 400: Invalid or missing parameter
.. _sec-bundledplugins-appkey-datamodel:
Data model
----------
.. _sec-bundledplugins-appkey-datamodel-keyrequest:
Key request
...........
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``app``
- 1
- str
- Application identifier to use for the request
* - ``user``
- 0..1
- str
- User identifier/name to restrict the request to
.. _sec-bundledplugins-appkey-datamodel-keyresponse:
Key response
............
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``apikey``
- 1
- str
- the API key generated for the application
.. _sec-bundledplugins-appkey-datamodel-decisionrequest:
Decision request
................
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``decision``
- 1
- boolean
- ``True`` if the access request it to be granted, ``False`` otherwise
.. _sec-bundledplugins-appkey-datamodel-listreponse:
List response
.............
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``keys``
- 1
- list of :ref:`key list entries <sec-bundledplugins-appkey-datamodel-keylistentry>`
- Keys registered in the system
* - ``pending``
- 1
- list of :ref:`pending list entries <sec-bundledplugins-appkey-datamodel-pendinglistentry>`
- Currently pending authorization requests
.. _sec-bundledplugins-appkey-datamodel-keylistentry:
Key list entry
..............
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``api_key``
- 1
- str
- API key
* - ``app_id``
- 1
- str
- Application identifier
* - ``user_id``
- 1
- str
- User ID of the key's owner
.. _sec-bundledplugins-appkey-datamodel-pendinglistentry:
Pending list entry
..................
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``app_id``
- 1
- str
- Application identifier
* - ``user_id``
- 0..1
- str
- optional: User ID of user who can grant or deny request
* - ``user_token``
- 1
- str
- Token to grant or deny request
.. _sec-bundledplugins-appkeys-jsclientlib:
JavaScript Client Library
-------------------------
.. js:function:: OctoPrintClient.plugins.appkeys.getKeys(opts)
Retrieves registered keys and pending requests for the current user.
See :ref:`Fetch list of existing application keys <sec-bundledplugins-appkeys-api-fetchlist>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.getAllKeys(opts)
Retrieves registered keys and pending requests for all users.
Needs administrator rights.
See :ref:`Fetch list of existing application keys <sec-bundledplugins-appkeys-api-fetchlist>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.generateKey(app, opts)
Generates a key for the given ``app`` and the current user.
See :ref:`Issue an application key command <sec-bundledplugins-appkeys-api-issuecommand>` for details.
:param string app: Application identifier
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.revokeKey(key, opts)
Revokes the given ``key``. The key must belong to the current user, or the current user must have administrator
rights.
See :ref:`Issue an application key command <sec-bundledplugins-appkeys-api-issuecommand>` for details.
:param string key: Key to revoke
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.decide(token, decision, opts)
Decides on an existing authorization request.
See :ref:`Decide on existing request <sec-bundledplugins-appkeys-api-decide>` for more details.
:param string token: User token for which to make the decision, as pushed to the client via the socket.
:param boolean decision: Whether to grant access (``true``) or not (``false``).
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.probe(opts)
Probes for workflow support.
See :ref:`Probe for workflow support <sec-bundledplugins-appkeys-api-probe>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.request(app, opts)
Starts a new authorization request for the provided ``app`` identifier.
See :ref:`Start authorization process <sec-bundledplugins-appkeys-api-startauthprocess>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.requestForUser(app, user, opts)
Starts a new authorization request for the provided ``app`` and ``user`` identifiers.
See :ref:`Start authorization process <sec-bundledplugins-appkeys-api-startauthprocess>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.checkDecision(token, opts)
Polls for a decision on an existing authorization request identified by ``token``.
See :ref:`Poll for decision on existing request <sec-bundledplugins-appkeys-api-polldecision>` for more details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.appkeys.authenticate(app, user, opts)
Convenience function that probes for support, issues a request and then automatically starts polling for a decision
on the returned polling endpoint every 1s, until either a positive or negative decision is returned. On success the
returned promise is resolved with the generated API key as argument. If anything goes wrong or there is no support
for the workflow, the promise is rejected.
**Example usage**
.. sourcecode:: javascript
OctoPrint.plugins.appkeys.authenticate("My App", "some_user")
.done(function(api_key) {
console.log("Got our API key:", api_key);
})
.fail(function() {
console.log("No API key for us");
})
:param string app: Application identifier
:param string user: Optional user identifier
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. _sec-bundledplugins-appkeys-sourcecode:
Source code
-----------
The source of the Application Keys plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/appkeys``.
-70
View File
@@ -1,70 +0,0 @@
.. _sec-bundledplugins-backup:
Backup Plugin
=============
The OctoPrint Backup Plugin comes bundled with OctoPrint (starting with 1.3.10).
It allows the creation and restoration of backups of OctoPrint's settings, data and installed plugins [#]_.
This allows easy migration
to newly setup instances as well as making regular backups to prevent data loss.
.. _fig-bundledplugins-backup-settings:
.. figure:: ../images/bundledplugins-backup-settings.png
:align: center
:alt: OctoPrint Backup Plugin
The plugin's settings panel with existing backups, the backup creation and restore sections.
As long as plugins adhere to the standard of storing their data and settings in OctoPrint's plugin data folders, their
data will be part of the backup. Note that the backups made by the Backup Plugin will *not* be part of any backups -
you'll need to persist the resulting zip files yourself!
.. _sec-bundledplugins-backup-cli:
Command line usage
------------------
The Backup Plugin implements a command line interface that allows creation and restoration of backups.
It adds two new commands, ``backup:backup`` and ``backup_restore``.
.. code-block:: none
$ octoprint plugins backup:backup --help
Initializing settings & plugin subsystem...
Usage: octoprint plugins backup:backup [OPTIONS]
Creates a new backup.
Options:
--exclude TEXT Identifiers of data folders to exclude, e.g. 'uploads' to
exclude uploads or 'timelapse' to exclude timelapses.
--help Show this message and exit.
$ octoprint plugins backup:restore --help
Initializing settings & plugin subsystem...
Usage: octoprint plugins backup:restore [OPTIONS] PATH
Restores an existing backup from the backup zip provided as argument.
OctoPrint does not need to run for this to proceed.
Options:
--help Show this message and exit.
.. note::
The ``backup:backup`` command can be useful in combination with a cronjob to create backups in regular intervals.
.. _sec-bundledplugins-backup-sourcecode:
Source code
-----------
The source of the Backup plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/backup``.
.. [#] Note that only those plugins that are available on `OctoPrint's official plugin repository <https://plugins.octoprint.org>`_
can be automatically restored. If you have plugins installed that are not available on there you'll get their
names and - if available - homepage URL displayed after restore in order to be able to manually reinstall them.
-191
View File
@@ -1,191 +0,0 @@
.. _sec-bundledplugins-discovery:
Discovery Plugin
================
The OctoPrint Discovery Plugin comes bundled with OctoPrint (starting with 1.2.0).
It allows discovery of the OctoPrint instances via SSDP/UPNP. If
`pybonjour <https://pypi.python.org/pypi/pybonjour>`_ is installed OctoPrint
will additionally support discovery via ZeroConf, also known as Bonjour or Avahi.
The SSDP/UPNP support allows OctoPrint to announce itself to machines on the same
network running Microsoft Windows. You will be able to just double click on the
OctoPrint instance icon in "Networks > Other Devices" in your Windows Explorer,
which will take you directly to the web frontend.
The ZeroConf support allows OctoPrint to announce itself to Safari on MacOS X
on the same network.
Linux users should install `Avahi <http://avahi.org>`_ and can then use one
of the various Avahi browsers (e.g. ``avahi-browse`` for the command
line) to scan for available instances.
.. _fig-bundledplugins-discovery-windowsexplorer:
.. figure:: ../images/bundledplugins-discovery-windowsexplorer.png
:align: center
:alt: OctoPrint instances in Windows Explorer
Various discovered OctoPrint instances in Windows Explorer
.. _sec-bundledplugins-discovery-firststeps:
First Steps
-----------
.. _sec-bundledplugins-discovery-firststeps-pybonjour:
Installing pybonjour
++++++++++++++++++++
.. note::
OctoPi versions 0.12.0 and later already come with pybonjour installed and ready to go,
you don't need to perform these steps there.
.. note::
Currently there are no releases for pybonjour available on the Python Package Index PyPI. The latest pybonjour
release is still available in the `Google Code Archive <https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz>`_.
Since that URL is hilariously long though, a shortened version is provided with https://goo.gl/SxQZ06 and
used in the installation instructions below.
In order for the Zeroconf discovery to work, the
`pybonjour package <https://pypi.python.org/pypi/pybonjour>`_ needs to be available
to the Python installation running OctoPrint.
It can be installed via ``pip``. Let's assume you installed OctoPrint manually
into some folder ``~/OctoPrint``. You executed ``python setup.py install`` within a
virtualenv in the same folder called ``venv``. In order to install ``pybonjour``
so it will be available to OctoPrint you'll need to do the following::
venv/bin/pip install https://goo.gl/SxQZ06
**Linux users:** You'll need to install an additional dependency for this to work, the
libdnssd compatibility layer for libavahi. On Debian/Ubuntu that can be achieved with::
sudo apt-get install libavahi-compat-libdnssd-dev
.. _sec-bundledplugins-discovery-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``publicPort``: Public port number OctoPrint is reachable under,
optional, if not set the port OctoPrint itself was started under will be used
* ``pathPrefix``: Path prefix OctoPrint is running under, optional, if not
set ``/`` will be used
* ``useSsl``: ``true`` if OctoPrint should be called via HTTPS, ``false`` otherwise
* ``httpUsername``: HTTP Basic Auth username OctoPrint is reachable with, optional
* ``httpPassword``: HTTP Basic Auth password OctoPrint is reachable with, optional
* ``upnpUuid``: uPNP UUID used for SSDP service announcements, usually you will
not have to touch this, will be autogenerated if not set
* ``zeroConf``: A list of additional services to announce via ZeroConf, optional,
see below.
* ``model``:
* ``name``: Name of the device model OctoPrint is running on, optional
* ``description``: Description of the device model OctoPrint is running on,
optional, used only for SSDP
* ``number``: Model number of the device OctoPrint is running on, optional,
used only for SSDP
* ``url``: URL with further details about the device OctoPrint is running on,
optional, used only for SSDP
* ``serial``: Serial number of the device OctoPrint is running on, optional,
used only for SSDP
* ``vendor``: Vendor of the device OctoPrint is running on, optional
* ``vendorUrl``: URL with further details about the vendor of the device
OctoPrint is running on, optional, used only for SSDP
.. _sec-bundledplugins-discovery-configuration-furtherzeroconf:
Further ZeroConf Services
+++++++++++++++++++++++++
The configuration also allows specifying additional ZeroConf service OctoPrint should
announce itself as. Each entry supports the following fields:
* ``service``: The service to announce, this is the only obligatory field
* ``name``: The name to announce, defaults to the OctoPrint instance name if not
supplied
* ``port``: The port to announce, defaults to the OctoPrint was started under if
not supplied
* ``txt_record``: The TXT record to publish with the DNS-SD record, should be a
map of keys and associated values.
.. _sec-bundledplugins-discovery-configuration-example:
Example
+++++++
The following snippet is a valid configuration example for the discovery plugin in OctoPrint's
:ref:`config.yaml <sec-configuration-config_yaml>`:
.. code-block:: yaml
plugins:
discovery:
publicPort: 443
useSsl: true
zeroConf:
- service: _someservice._tcp
port: 1234
txt_record:
field1: value1
field2: value2
model:
name: Some Model
vendor: Some Vendor
.. _sec-bundledplugins-discovery-announcedservices:
Announced Services
------------------
.. _sec-bundledplugins-discovery-announcedservices-http:
ZeroConf Service ``_http._tcp``
+++++++++++++++++++++++++++++++
If :ref:`pybonjour <sec-bundledplugins-discovery-firststeps-pybonjour>` is
correctly installed, OctoPrint will announce itself on the network via ZeroConf
as service ``_http._tcp``, with the TXT record containing the standard fields.
See also `this documentation of _http._tcp TXT records <http://www.dns-sd.org/txtrecords.html>`_
for more information.
.. _sec-bundledplugins-discovery-announcedservices-octoprint:
ZeroConf Service ``_octoprint._tcp``
++++++++++++++++++++++++++++++++++++
If :ref:`pybonjour <sec-bundledplugins-discovery-firststeps-pybonjour>` is
correctly installed, OctoPrint will announce itself on the network via ZeroConf
as service ``_octoprint._tcp``. The TXT record may contain the following fields:
* ``path``: path prefix to actual OctoPrint instance, inherited from ``_http._tcp``
* ``u``: username if HTTP Basic Auth is used, optional, inherited from ``_http._tcp``
* ``p``: password if HTTP Basic Auth is used, optional, inherited from ``_http._tcp``
* ``version``: OctoPrint software version
* ``api``: OctoPrint API version
* ``model``: Model of the device that is running OctoPrint, optional
* ``vendor``: Vendor of the device that is running OctoPrint, optional
Clients should construct the full path to the OctoPrint instance from this information
following this scheme::
http://[u[:p]@]host:port[path]
See also `this documentation of _http._tcp TXT records <http://www.dns-sd.org/txtrecords.html>`_
for more information.
.. _sec-bundledplugins-discovery-sourcecode:
Source code
-----------
The source of the Discovery plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/discovery``.
-40
View File
@@ -1,40 +0,0 @@
.. _sec-bundledplugins-errortracking:
Error Tracking Plugin
=====================
The Error Tracking plugin will cause any logged exceptions in the server and the browser interface to be sent to
OctoPrint's `Sentry instance <https://sentry.io/>`_.
By enabling it you help to gather detailed information on the cause of bugs or other issues. This is especially
valuable on release candidates, which is why this plugin will also prompt you to enable error tracking if it detects
that you are subscribed to an RC release channel.
By default, even when enabled it will only be active if you are running a released OctoPrint version, so either a stable
release or a release candidate.
The Error Tracking plugin is using a Sentry instance kindly provided by `sentry.io <https://sentry.io/>`_. For information on their service
please refer to their `Security & Compliance documentation <https://sentry.io/security/>`_
and their `Privacy Policy <https://sentry.io/privacy/>`_.
The Error Tracking plugin has been bundled with OctoPrint since version 1.3.11.
.. _sec-bundledplugins-errortracking-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``enabled``: Whether to enable error tracking. Defaults to ``false``.
* ``enabled_unreleased``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases
or release candidates). Defaults to ``false``.
* ``unique_id``: Unique instance identifier, auto generated on first activation
.. _sec-bundledplugins-errortracking-sourcecode:
Source Code
-----------
The source of the Error Tracking plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/errortracking``.
-35
View File
@@ -1,35 +0,0 @@
.. _sec-bundledplugins-forcelogin:
ForceLogin Plugin
=================
The ForceLogin Plugin comes bundled with OctoPrint (starting with version 1.3.10). It removes the anonymous
read-only access that up until 1.3.10 was standard when accessing OctoPrint instances without being logged in and
instead forces users to log in if they want to get any kind of information from OctoPrint.
.. _fig-bundledplugins-forcelogin:
.. figure:: ../images/bundledplugins-forcelogin-dialog.png
:align: center
:alt: Forced login dialog
OctoPrint's new forced login dialog.
.. warning::
Keep in mind that **OctoPrint does not manage your webcam**, it merely embeds it. If you have a webcam,
it will still be accessible to users who are not logged in under its (guessable) URL. If you need to restrict
access to your webcam, you'll need to find a way to do so directly on the webcam server which - again -
is not OctoPrint itself.
.. note::
If you want back the old behaviour of allowing anonymous read-only access to your OctoPrint instance, disable
the ForceLogin Plugin in OctoPrint's plugin manager.
.. _sec-bundledplugins-forcelogin-sourcecode:
Source code
-----------
The source of the ForceLogin plugin is bundled with OctoPrint and can be found in
its source repository under ``src/octoprint/plugins/forcelogin``.
-21
View File
@@ -1,21 +0,0 @@
.. _sec-bundledplugins:
###############
Bundled Plugins
###############
.. toctree::
:maxdepth: 2
action_command_prompt.rst
announcements.rst
tracking.rst
appkeys.rst
backup.rst
discovery.rst
errortracking.rst
forcelogin.rst
logging.rst
pluginmanager.rst
printer_safety_check.rst
softwareupdate.rst
-238
View File
@@ -1,238 +0,0 @@
.. _sec-bundledplugins-logging:
Logging
=======
The OctoPrint Logging plugin comes bundled with OctoPrint starting with version 1.3.7.
It implements the log management functionality that was formerly part of the core application and adds features to
configure logging levels for sub modules through the included settings dialog.
.. _fig-bundledplugins-logging-settings:
.. figure:: ../images/bundledplugins-logging-settings.png
:align: center
:alt: Logging plugin
The settings dialog of the Logging plugin
.. _sec-bundledplugins-logging-api:
API
---
.. note::
All log file management operations require admin rights.
.. _sec-bundledplugins-logging-api-list_logs:
Retrieve a list of available log files
++++++++++++++++++++++++++++++++++++++
.. http:get:: /plugin/logging/logs
Retrieve information regarding all log files currently available and regarding the disk space still available
in the system on the location the log files are being stored.
Returns a :ref:`Logfile Retrieve response <sec-bundledplugins-logging-api-datamodel-retrieveresponse>`.
**Example**
.. sourcecode:: http
GET /plugin/logging/logs HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
.. sourcecode:: http
HTTP/1.1 200 OK
Content-Type: application/json
{
"files" : [
{
"date" : 1393158814,
"name" : "octoprint.log",
"size" : 43712,
"refs": {
"resource": "http://example.com/plugin/logging/logs/octoprint.log",
"download": "http://example.com/downloads/logs/octoprint.log"
}
},
{
"date" : 1392628936,
"name" : "octoprint.log.2014-02-17",
"size" : 13205,
"refs": {
"resource": "http://example.com/plugin/logging/logs/octoprint.log.2014-02-17",
"download": "http://example.com/downloads/logs/octoprint.log.2014-02-17"
}
},
{
"date" : 1393158814,
"name" : "serial.log",
"size" : 1798419,
"refs": {
"resource": "http://example.com/plugin/logging/logs/serial.log",
"download": "http://example.com/downloads/logs/serial.log"
}
}
],
"free": 12237201408
}
:statuscode 200: No error
:statuscode 403: If the given API token did not have admin rights associated with it
.. _sec-bundledplugins-logging-api-delete_logs:
Delete a specific logfile
+++++++++++++++++++++++++
.. http:delete:: /plugin/logging/logs/(path:filename)
Delete the selected log file with name `filename`.
Returns a :http:statuscode:`204` after successful deletion.
**Example Request**
.. sourcecode:: http
DELETE /plugin/logging/logs/octoprint.log.2014-02-17 HTTP/1.1
Host: example.com
X-Api-Key: abcdef...
:param filename: The filename of the log file to delete
:statuscode 204: No error
:statuscode 403: If the given API token did not have admin rights associated with it
:statuscode 404: If the file was not found
.. _sec-bundledplugins-logging-api-datamodel:
Data model
++++++++++
.. _sec-bundledplugins-logging-api-datamodel-retrieveresponse:
Logfile Retrieve Response
~~~~~~~~~~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``files``
- 0..*
- Array of :ref:`File information items <sec-bundledplugins-logging-api-datamodel-fileinfo>`
- The list of requested files. Might be an empty list if no files are available
* - ``free``
- 1
- String
- The amount of disk space in bytes available in the local disk space (refers to OctoPrint's ``logs`` folder).
.. _sec-bundledplugins-logging-api-datamodel-fileinfo:
File information
~~~~~~~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``name``
- 1
- String
- The name of the file
* - ``size``
- 1
- Number
- The size of the file in bytes.
* - ``date``
- 1
- Unix timestamp
- The timestamp when this file was last modified.
* - ``refs``
- 1
- :ref:`References <sec-bundledplugins-logging-api-datamodel-ref>`
- References relevant to this file
.. _sec-bundledplugins-logging-api-datamodel-ref:
References
~~~~~~~~~~
.. list-table::
:widths: 15 5 10 30
:header-rows: 1
* - Name
- Multiplicity
- Type
- Description
* - ``resource``
- 1
- URL
- The resource that represents the file (e.g. for deleting)
* - ``download``
- 1
- URL
- The download URL for the file
.. _sec-bundledplugins-logging-jsclientlib:
JS Client Library
-----------------
:mod:`OctoPrintClient.plugins.logging`
--------------------------------------
.. note::
All methods here require that the used API token or the existing browser session
has admin rights.
.. js:function:: OctoPrintClient.plugins.logging.listLogs(opts)
Retrieves a list of log files.
See :ref:`Retrieve a list of available log files <sec-bundledplugins-logging-api-list_logs>` for details.
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.logging.deleteLog(path, opts)
Deletes the specified log ``path``.
See :ref:`Delete a specific log file <sec-bundledplugins-logging-api-delete_logs>` for details.
:param string path: The path to the log file to delete
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. js:function:: OctoPrintClient.plugins.logging.downloadLog(path, opts)
Downloads the specified log ``file``.
See :js:func:`OctoPrint.download` for more details on the underlying library download mechanism.
:param string path: The path to the log file to download
:param object opts: Additional options for the request
:returns Promise: A `jQuery Promise <http://api.jquery.com/Types/#Promise>`_ for the request's response
.. _sec-bundledplugins-logging-sourcecode:
Source Code
-----------
The source of the Logging plugin is bundled with OctoPrint and can be found in its source repository under ``src/octoprint/plugins/logging``.
-159
View File
@@ -1,159 +0,0 @@
.. _sec-bundledplugins-pluginmanager:
Plugin Manager
==============
The OctoPrint Plugin Manager comes bundled with OctoPrint starting with
version 1.2.0.
It allows management of installed plugins (listing, enabling, disabling
and uninstalling) and installing new plugins from the official
`OctoPrint Plugin Repository <http://plugins.octoprint.org>`_, web addresses
or uploaded file archives.
.. _fig-bundledplugins-pluginmanager-mainscreen:
.. figure:: ../images/bundledplugins-pluginmanager-mainscreen.png
:align: center
:alt: Plugin Manager
The main dialog of the Plugin Manager
.. _fig-bundledplugins-pluginmanager-installing:
.. figure:: ../images/bundledplugins-pluginmanager-installing.png
:align: center
:alt: Installation dialog
Dialog for installing new plugins
.. _fig-bundledplugins-pluginmanager-repofilters:
.. figure:: ../images/bundledplugins-pluginmanager-repofilters.png
:align: center
:alt: Filter options for the repository browser
Filter options for the repository browser
.. _sec-bundledplugins-pluginmanager-configuration:
Configuring the Plugin
----------------------
The Plugin Manager plugin only has a handful of configuration settings
which normally won't have to be touched.
You can modify them either through the plugin's configuration dialog that
you can open when clicking the little wrench icon in the upper right corner
under Settings > Plugin Manager, or by directly editing ``config.yaml``:
.. code-block:: yaml
plugins:
pluginmanager:
# The URL of the repository index to use
repository: http://plugins.octoprint.org/plugins.json
# Time to live for the repository cache
repository_ttl: 1440
# The URL of the plugin notices feed to use
notices: http://plugins.octoprint.org/notices.json
# Time to live for the notices feed cache
notices_ttl: 360
# Additional arguments to use with pip. Defaults to unset,
# you normally shouldn't need to modify this
pip_args: --some --additional --pip --arguments
# Whether to force the --user flag with pip. Defaults to
# false, you normally shouldn't need to modify this
pip_force_user: false
# Whether to have pip always follow dependency links.
# Defaults to false, you normally shouldn't need to
# modify this
dependency_links: false
# List of plugin identifiers hidden from the plugin
# manager. Defaults to an empty list. Not available
# through the configuration dialog, only available
# to allow for vendor customization
hidden:
- some
- hidden
- plugins
.. _sec-bundledplugins-pluginmanager-events:
Events
------
plugin_pluginmanager_install_plugin
A plugin was installed.
Payload:
* ``id``: the identifier of the installed plugin
* ``version``: the version of the installed plugin
* ``source``: source from which the plugin was installed, can be an URL or a path in the local file system
* ``source_type``: type of source from which the plugin was installed, can be ``url`` or ``path``
plugin_pluginmanager_uninstall_plugin
A plugin was uninstalled.
Payload:
* ``id``: the identifier of the uninstalled plugin
* ``version``: the version of the uninstalled plugin
plugin_pluginmanager_enable_plugin
A plugin was enabled.
Payload:
* ``id``: the identifier of the enabled plugin
* ``version``: the version of the enabled plugin
plugin_pluginmanager_disabled_plugin
A plugin was disabled.
Payload:
* ``id``: the identifier of the disabled plugin
* ``version``: the version of the disabled plugin
.. _sec-bundledplugins-pluginmanager-hooks:
Hooks
-----
.. _sec-bundledplugins-pluginmanager-hooks-reconnect_hooks:
octoprint.plugin.pluginmanager.reconnect_hooks
++++++++++++++++++++++++++++++++++++++++++++++
.. py:function:: reconnect_hooks_hook(*args, **kwargs)
Returns additional hooks defined by the plugin for which the plugin manager
should display the "You should reconnect to your printer" message on plugin
install/uninstall/enabling/disabling.
Handlers should return a Python list containing the affected hook names.
**Example**
.. code-block:: python
def reconnect_hooks_hook(*args, **kwargs):
return ["octoprint.plugin.exampleplugin.some_custom_hook",
"octoprint.plugin.exampleplugin.some_other_custom_hook"]
__plugin_hooks__ = {
"octoprint.plugin.pluginmanager.reconnect_hooks": reconnect_hooks_hook
}
.. _sec-bundledplugins-pluginmanager-sourcecode:
Source Code
-----------
The source of the Plugin Manager is bundled with OctoPrint and can be found in its source repository under ``src/octoprint/plugins/pluginmanager``.
@@ -1,52 +0,0 @@
.. _sec-bundledplugins-printer_safety_check:
Printer Safety Check
====================
The Printer Safety Check plugin comes bundled with OctoPrint starting with version 1.3.7.
It tries to identify printers or rather printer firmwares with known safety issues, such as
disabled thermal runaway protection, and displays a warning box to logged in users on
such identification.
.. _fig-bundledplugins-printer_safety_check-example:
.. figure:: ../images/bundledplugins-printer_safety_check-example.png
:align: center
:alt: Printer Safety Check warning example
An example of a warning generated by the Printer Safety Check
Please refer to the `entry on the "unsafe firmware" warning in OctoPrint's FAQ <https://faq.octoprint.org/warning-firmware-unsafe>`_
for a list of currently identified printers.
If you know of further printers/printer firmwares that need to be added here, please
`get in touch on the forum and provide their response to an M115 <https://faq.octoprint.org/warning-firmware-unsafe>`_.
.. note::
Feel free to disable the plugin in OctoPrint's Plugin Manager if you feel like it is unnecessary. Be advised though
that even if your printer might be running totally fine with a known unsafe configuration, that might change
unexpectedly and with `catastrophic <https://www.thissmarthouse.net/dont-burn-your-house-down-3d-printing-a-cautionary-tale/>`_
`results <https://www.reddit.com/r/3Dprinting/comments/6cekgk/house_fire_thanks_to_cheap_printer_from_china/>`_.
.. _sec-bundledplugins-printer_safety_check-events:
Events
------
warning
A printer safety warning was triggered.
Payload:
* ``check_type``: type of check that was triggered (e.g. ``m115``, ``received`` or ``cap``)
* ``check_name``: name of check that was triggered (e.g. ``aneta8``)
* ``warning_type``: type of warning that was triggered (e.g. ``firmware-unsafe``)
.. _sec-bundledplugins-printer_safety_check-source:
Source Code
-----------
The source of the Printer Safety Check plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/printer_safety_check``.
-454
View File
@@ -1,454 +0,0 @@
.. _sec-bundledplugins-softwareupdate:
Software Update Plugin
======================
The Software Update Plugin allows receiving notifications about new releases
of OctoPrint or installed plugins which registered with it and -- if properly
configured -- also applying the found updates.
.. _sec-bundledplugins-softwareupdate-firststeps:
First Steps
-----------
Out of the box the Software Update Plugin will be able to notify you of any
updates that might be available for your OctoPrint installation or any plugins
that registered themselves with it. In order for automatic restarts after updates
to work, you should configure the restart commands for OctoPrint and the whole server.
Out of the box the plugin should already be ready to update your OctoPrint installation to current
stable release versions, but you can also switch to one of the available release candidate channels
or outright git commit tracking via the plugin's configuration dialog. To open this dialog, fire up OctoPrint's
Settings Dialog, navigate to the Software Update section therein and once you are there click on the little
wrench icon in the upper right corner.
.. _fig-bundledplugins-softwareupdate-plugin-configuration:
.. figure:: ../images/bundledplugins-softwareupdate-plugin-configuration.png
:align: center
:alt: Software Update plugin configuration dialog
The Software Update plugin configuration dialog
There you can adjust the following settings:
* **OctoPrint version tracking**: Whether you want to track OctoPrint *releases* or every *commit*. Usually you want to
select "Release" here which is also the default, unless you are a developer.
* **OctoPrint Release Channel** (if tracking releases): The release channel of OctoPrint to track for updates. If you only want stable versions,
select "Stable" here which is also the default. "Maintenance RCs" will also allow you to update to maintenance release
candidates, "Devel RCs" will also allow you to update to development release candidates. If in doubt, leave it at
"Stable". `Read more about Release Channels here <https://github.com/foosel/OctoPrint/wiki/Using-Release-Channels>`_.
* **OctoPrint checkout folder** (if tracking git commits): This must be the path to OctoPrint's git checkout folder
(``/home/pi/OctoPrint`` for OctoPi or `manual installs following the Raspberry Pi setup guide <https://github.com/foosel/OctoPrint/wiki/Setup-on-a-Raspberry-Pi-running-Raspbian>`_).
Note that since OctoPrint 1.3.6 you will no longer need to set this to be able to update to releases, only if you
want to be able to update against some bleeding edge git branch.
* **Version cache TTL**: The "time to live" of the cache OctoPrint will use to temporarily persist the version information
for the various components registered with the plugin, so that they don't have to be queried from the internet every time
you load the page. Defaults to 24h, you usually shouldn't need to change that value.
More settings are available by :ref:`editing the corresponding section in config.yaml <sec-bundledplugins-softwareupdate-configuration>`.
That restart commands for OctoPrint and the whole server can be configured under Settings > Server.
.. _sec-bundledplugins-softwareupdate-cli:
Command line usage
------------------
The functionality of the Software Update Plugin is also available on OctoPrint's command line interface under the
``plugins`` sub command. It's possible to check for updates via ``octoprint plugins softwareupdate:check``
and to apply available updates via ``octoprint plugins softwareupdate:update``. Please see the corresponding
``--help`` pages for details:
.. code-block:: none
$ octoprint plugins softwareupdate:check --help
Usage: octoprint plugins softwareupdate:check [OPTIONS] [TARGETS]...
Check for updates.
If any TARGETs are provided, only those components will be checked.
Examples:
- octoprint plugins softwareupdate:check
This will check all components for available updates,
utilizing cached version information.
- octoprint plugins softwareupdate:check --force
This will check all components for available updates,
ignoring any cached version information even if it's
still valid.
- octoprint plugins softwareupdate:check octoprint
This will only check OctoPrint itself for available
updates.
Options:
--force Ignore the cache for the update check
--help Show this message and exit.
.. code-block:: none
$ octoprint plugins softwareupdate:update --help
Usage: octoprint plugins softwareupdate:update [OPTIONS] [TARGETS]...
Apply updates.
If any TARGETs are provided, only those components will be updated.
Examples:
- octoprint plugins softwareupdate:update
This will update all components with a pending update
that can be updated.
- octoprint plugins softwareupdate:update --force
This will force an update of all registered components
that can be updated, even if they don't have an updated
pending.
- octoprint plugins softwareupdate:update octoprint
This will only update OctoPrint and leave any further
components with pending updates at their current versions.
Options:
--force Update even if already up to date
--help Show this message and exit.
.. _sec-bundledplugins-softwareupdate-configuration:
Configuring the Plugin
----------------------
.. code-block:: yaml
plugins:
softwareupdate:
# the time-to-live of the version cache, in minutes
cache_ttl: 60
# configured version check and update methods
checks:
# "octoprint" is reserved for OctoPrint
octoprint:
# this defines a version check that will check against releases
# published on OctoPrint's Github repository and pip as update method
# against the release archives on Github - this is the default
type: github_release
user: foosel
repo: OctoPrint
method: pip
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
# further checks may be defined here
# pip command, if another one than the automatically detected one should be
# used - should normally NOT be necessary and hence set
pip_command: /path/to/pip
.. _sec-bundledplugins-softwareupdate-configuration-versionchecks:
Version checks
++++++++++++++
* ``github_release``: Checks against releases published on Github. Additional
config parameters:
* ``user``: (mandatory) Github user the repository to check belongs to
* ``repo``: (mandatory) Github repository to check
* ``prerelease``: ``True`` or ``False``, default ``False``, set to
``True`` to also include releases on Github marked as prerelease.
* ``release_branch``: Branch name to check against ``target_comittish``
field in Github release data - release will only be included if the
values match. Defaults to being unset, in which case no match will
be performed.
* ``release_compare``: Method to use to compare between current version
information and release versions on Github. One of ``python`` (version
comparison using ``pkg_resources.parse_version``, newer version detected
if remote > current), ``semantic`` (version comparison using
``semantic_version`` package, newer version detected if remote > current)
and ``unequal`` (string comparison, newer version detected if
remote != current).
* ``github_commit``: Checks against commits pushed to Github. Additional
config parameters:
* ``user``: (mandatory) Github user the repository to check belongs to
* ``repo``: (mandatory) Github repository to check
* ``branch``: Branch of the Github repository to check, defaults to
``master`` if not set.
* ``current``: Current commit hash. Will be updated automatically.
* ``bitbucket_commit``: Checks against commits pushed to Bitbucket. Additional
config parameters:
* ``user``: (mandatory) Bitbucket user the repository to check belongs to
* ``repo``: (mandatory) Bitbucket repository to check
* ``branch``: Branch of the Bitbucket repository to check, defaults to
``master`` if not set.
* ``current``: Current commit hash. Will be updated automatically.
* ``api_user``: (mandatory only for private repositories) Bitbucket user name (not email address).
Requires ``api_password`` to be set. Hint: This is used for the check only. For the actual
download you might register your public SSH key as access key for the according repo and
configure this as pip URL in ``config.yaml``: ``git+ssh://git@bitbucket.org/my_user/my_repo.git@{target_version}``
* ``api_password``: (mandatory only for private repositories) App password. Requires
``api_user`` to be set. **Important**: Never use your actual Bitbucket login password. Generate
a new app password. App passwords are user specific on Bitbucket.
* ``git_commit``: Checks a local git repository for new commits on its
configured remote. Additional config parameters:
* ``checkout_folder``: (mandatory) The full path to the folder with a valid git
repository to check.
* ``command_line``: Uses a provided script to determine whether an update
is available. Additional config parameters:
* ``command``: (mandatory) The full path to the script to execute. The script is
expected to return a ``0`` return code if an update is available and to
return the display name of the available version as the final and
optionally the display name of the current version as the next to final
line on stdout.
* ``python_checker``: Can only be specified by plugins through the
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. Additional config
parameters:
* ``python_checker``: (mandatory) A Python callable which returns version
information and whether the current version is up-to-date or not, see
below for details.
* ``always_current``: Always reports that no update is necessary. Useful for debugging
software update mechanisms during development. Additional config parameters:
* ``current_version``: Version to report for both local and remote version.
* ``never_current``: Always reports that an update is necessary. Useful for debugging
software update mechanisms during development. Additional config parameters:
* ``local_version``: Current local version. Defaults to ``1.0.0``.
* ``remote_version``: Remote version to offer update to. Defaults to ``1.0.1``.
.. _sec-bundledplugins-softwareupdate-configuration-updatemethods:
Update methods
++++++++++++++
* ``pip``: An URL to provide to ``pip install`` in order to perform the
update. May contain a placeholder ``{target}`` which will be the most
recent version specifier as retrieved from the update check.
* ``update_script``: A script to execute in order to perform the update. May
contain placeholders ``{target}`` (for the most recent version specified
as retrieved from the update check), ``{branch}`` for the branch to switch
to to access the release, ``{folder}`` for the working directory
of the script and ``{python}`` for the python executable OctoPrint is
running under. The working directory must be specified either by an
``update_folder`` setting or if the ``git_commit`` check is used its
``checkout_folder`` setting.
* ``python_updater``: Can only be specified by plugins through the
:ref:`hook <sec-bundledplugins-softwareupdate-hooks>`. A Python callable
which performs the update, see below for details.
* ``sleep_a_bit``: Does nothing but block for a configurable ``duration`` and log
a countdown in the meantime. Useful for debugging software update mechanisms
during development.
.. note::
To allow default configurations for multiple update methods, if more than one of
the above update method specific settings is set the one to use can be selected
by setting the property ``method`` to the method specific setting in question.
**Example**
The following example defines both ``pip`` and ``update_script``. By setting to
``method`` to ``pip``, the Software Update plugin is instructed to use that as
update method.
.. code-block:: yaml
plugins:
softwareupdate:
checks:
octoprint:
type: github_release
user: foosel
repo: OctoPrint
method: pip
pip: 'https://github.com/foosel/OctoPrint/archive/{target_version}.zip'
update_script: '{python} "/path/to/octoprint-update.py" --python="{python}" "{folder}" "{target}"'
checkout_folder: /path/to/octoprint/checkout/folder
.. _sec-bundledplugins-softwareupdate-configuration-patterns:
Common configuration patterns
+++++++++++++++++++++++++++++
Example for a setup that allows "bleeding edge" updates of OctoPrint under
OctoPi (the ``update_script`` gets configured correctly automatically by the
plugin itself):
.. code-block:: yaml
plugins:
softwareupdate:
checks:
octoprint:
type: github_commit
user: foosel
repo: OctoPrint
branch: devel
method: update_script
update_folder: /home/pi/OctoPrint
Plugin installed via pip and hosted on Github under
``https://github.com/someUser/OctoPrint-SomePlugin``, only releases should be
tracked:
.. code-block:: yaml
plugins:
softwareupdate:
checks:
some_plugin:
type: github_release
user: someUser
repo: OctoPrint-SomePlugin
pip: 'https://github.com/someUser/OctoPrint-SomePlugin/archive/{target}.zip'
The same, but tracking all commits pushed to branch ``devel`` (thus allowing
"bleeding edge" updates):
.. code-block:: yaml
plugins:
softwareupdate:
checks:
some_plugin:
type: github_commit
user: someUser
repo: OctoPrint-SomePlugin
branch: devel
pip: 'https://github.com/someUser/OctoPrint-SomePlugin/archive/{target}.zip'
.. _sec-bundledplugins-softwareupdate-events:
Events
------
plugin_softwareupdate_update_succeeded
An update succeeded.
Payload:
* ``target``: update target
* ``from_version``: version from which was updated
* ``to_version``: version to which was updated
plugin_softwareupdate_update_failed
An update failed.
Payload:
* ``target``: update target
* ``from_version``: version from which was updated
* ``to_version``: version to which was updated
.. _sec-bundledplugins-softwareupdate-hooks:
Hooks
-----
.. _sec-bundledplugins-softwareupdate-hooks-check_config:
octoprint.plugin.softwareupdate.check_config
++++++++++++++++++++++++++++++++++++++++++++
.. py:function:: update_config_hook(*args, **kwargs)
Returns additional check configurations for the Software Update plugin.
Handlers should return a Python dict containing one entry per check. Usually
this will probably only be the check configuration for the plugin providing
the handler itself, using the plugin's identifier as key.
The check configuration must match the format expected in the configuration
(see description above). Handlers may also utilize the ``python_checker``
and ``python_updater`` properties to return Python callables that take care
of performing the version check or the update.
``python_checker`` is expected to be a callable matching signature and return
value of the ``get_latest`` methods found in the provided version checkers in
``src/octoprint/plugins/softwareupdate/version_checks``. ``python_updater``
is expected to be a callable matching signature and return value of the
``perform_update`` methods found in the provided updaters in
``src/octoprint/plugins/softwareupdate/updaters``.
**Example**
The example single-file-plugin updates itself from Github releases published
at the (fictional) repository ``https://github.com/someUser/OctoPrint-UpdatePluginDemo``.
.. code-block:: python
# coding=utf-8
from __future__ import absolute_import
def get_update_information(*args, **kwargs):
return dict(
updateplugindemo=dict(
displayName=self._plugin_name,
displayVersion=self._plugin_version,
type="github_release",
current=self._plugin_version,
user="someUser",
repo="OctoPrint-UpdatePluginDemo",
pip="https://github.com/someUser/OctoPrint-UpdatePluginDemo/archive/{target}.zip"
)
)
__plugin_hooks__ = {
"octoprint.plugin.softwareupdate.check_config": get_update_information
}
:return: A dictionary of check configurations as described above
:rtype: dict
.. _sec-bundledplugins-softwareupdate-helpers:
Helpers
-------
.. _sec-bundledplugins-softwareupdate-helpers-version_checks:
version_checks
++++++++++++++
``version_checks`` module of the Software Update plugin, allows reusing the
bundled version check variants from plugins (e.g. wrapped in a ``python_checker``).
.. _sec-bundledplugins-softwareupdate-helpers-updaters:
updaters
++++++++
``updaters`` module of the Software Update plugin, allows reusing the bundled
updater variants from plugins (e.g. wrapped in a ``python_updater``).
.. _sec-bundledplugins-softwareupdate-helpers-exceptions:
exceptions
++++++++++
``exceptions`` module of the Software Update plugin.
.. _sec-bundledplugins-softwareupdate-helpers-util:
util
++++
``util`` module of the Software Update plugin.
.. _sec-bundledplugins-softwareupdate-source:
Source Code
-----------
The source of the Software Update plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/softwareupdate``.
-45
View File
@@ -1,45 +0,0 @@
.. _sec-bundledplugins-tracking:
Anonymous Usage Tracking Plugin
===============================
The Anonymous Usage Tracking plugin provides valuable insights into how many instances running what versions of
OctoPrint are out there, whether they are successfully completing print jobs and various other metrics.
By enabling it you help to identify problems with new releases and release candidates early on, and to better tailor
OctoPrint's future development to actual use.
For details on what gets tracked, please refer to `tracking.octoprint.org <https://tracking.octoprint.org>`_
and also the `Privacy Policy at tracking.octoprint.org <https://tracking.octoprint.org/privacy>`_.
The Anonymous Usage Tracking plugin has been bundled with OctoPrint since version 1.3.10.
.. _sec-bundledplugins-tracking-configuration:
Configuring the plugin
----------------------
The plugin supports the following configuration keys:
* ``enabled``: Whether to enable usage tracking. Defaults to ``false``.
* ``unique_id``: Unique instance identifier, auto generated on first activation
* ``server``: The tracking server to track against. Defaults to a tracking endpoint on ``https://tracking.octoprint.org``.
* ``ping``: How often to send a ``ping`` tracking event, in seconds. Defaults to a 15min interval.
* ``events``: Granular configuration of enabled tracking events. All default to ``true``.
* ``startup``: Whether to track startup/shutdown events
* ``printjob``: Whether to track print job related events (start, completion, cancel, ...)
* ``commerror``: Whether to track communication errors with the printer
* ``plugin``: Whether to track plugin related events (install, uninstall, ...)
* ``update``: Whether to track update related events (update successful or not, ...)
* ``printer``: Whether to track printer related events (connected, firmware, ...)
* ``printer_safety_check``: Whether to track warnings of the :ref:`Printer Safety Check <sec-bundledplugins-printer_safety_check>`
* ``throttled``: Whether to track throttle events detected on the underlying system
.. _sec-bundledplugins-tracking-sourcecode:
Source Code
-----------
The source of the Anonymous Usage Tracking plugin is bundled with OctoPrint and can be
found in its source repository under ``src/octoprint/plugins/tracking``.
+15 -21
View File
@@ -17,7 +17,6 @@ import sys, os
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../src/'))
sys.path.append(os.path.abspath('sphinxext'))
import octoprint._version
from datetime import date
@@ -28,12 +27,11 @@ year_current = date.today().year
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = '1.3'
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['codeblockext', 'onlineinclude', 'sphinx.ext.todo', 'sphinx.ext.autodoc', 'sphinxcontrib.httpdomain',
'sphinx.ext.napoleon', 'sphinxcontrib.mermaid']
extensions = ['sphinx.ext.todo', 'sphinx.ext.autodoc', 'sphinxcontrib.httpdomain']
todo_include_todos = True
# Add any paths that contain templates here, relative to this directory.
@@ -98,7 +96,6 @@ pygments_style = 'sphinx'
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
numfig = True
# -- Options for HTML output ---------------------------------------------------
@@ -106,12 +103,12 @@ numfig = True
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of built-in themes.
# a list of builtin themes.
#html_theme = "sphinx_rtd_theme"
# Theme options are theme-specific and customize the look and feel of a theme
@@ -139,13 +136,10 @@ if not on_rtd: # only import and set the theme if we're building docs locally
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the built-in static files,
# so a file named "default.css" will overwrite the built-in "default.css".
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
def setup(app):
app.add_stylesheet("theme_overrides.css")
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
@@ -193,7 +187,7 @@ htmlhelp_basename = 'OctoPrintdoc'
# -- Options for LaTeX output --------------------------------------------------
#latex_elements = {
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
@@ -202,20 +196,20 @@ htmlhelp_basename = 'OctoPrintdoc'
# Additional stuff for the LaTeX preamble.
#'preamble': '',
#}
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
#latex_documents = [
# ('index', 'OctoPrint.tex', u'OctoPrint Documentation',
# u'Gina Häußge', 'manual'),
#]
latex_documents = [
('index', 'OctoPrint.tex', u'OctoPrint Documentation',
u'Gina Häußge', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then top-level headings are parts,
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
File diff suppressed because it is too large. Load diff
-12
View File
@@ -1,12 +0,0 @@
.. _sec-configuration:
#############
Configuration
#############
.. toctree::
:maxdepth: 2
yaml.rst
config_yaml.rst
logging_yaml.rst
-100
View File
@@ -1,100 +0,0 @@
.. _sec-configuration-logging_yaml:
logging.yaml
============
The logging configuration file ``logging.yaml`` for OctoPrint is expected in its settings folder, which unless defined
differently on the command line is located at ``~/.octoprint`` on Linux, at ``%APPDATA%/OctoPrint`` on Windows and at
``~/Library/Application Support/OctoPrint`` on MacOS.
You can use it to change the log levels of the individual components within OctoPrint, which might be necessary to help
in debugging issues you are experiencing, or to change the configuration of the logging handlers themselves, e.g. in
order to change size after which to rollover the ``serial.log``.
Changing log levels
-------------------
If you need to change the default logging level within OctoPrint, create the file with a text editor of your choice
(it's usually not there). The general format is this::
loggers:
<component>:
level: <loglevel>
with ``<component>`` being the internal OctoPrint component for which to change the loglevel, and ``<loglevel>`` being the
new log level to set. An example for increasing the log level of the events and the file management components to
``DEBUG`` (the highest amount of logging) would be this ``logging.yaml``:
.. code-block:: yaml
loggers:
octoprint.events:
level: DEBUG
octoprint.filemanager:
level: DEBUG
A list of important components for which an increase in logging might be interesting follows:
* ``octoprint.events``: the event sub system
* ``octoprint.filemanager``: the file management layer
* ``octoprint.plugin``: the plugin sub system
* ``octoprint.plugins.<plugin>``: the plugin ``<plugin>``, e.g. ``octoprint.plugins.discovery`` to change the log level of
the :ref:`Discovery plugin <sec-bundledplugins-discovery>` or ``octoprint.plugins.backup``
to change the log level of the :ref:`Backup plugin <sec-bundledplugins-backup>`.
* ``octoprint.slicing``: the slicing sub system
This list will be expanded when deemed necessary.
Changing logging handlers
-------------------------
You can also change the configuration of the logging handlers themselves, e.g. in order to make the ``serial.log`` larger
for debugging long running communications or to change the behaviour of the ``octoprint.log``.
You can find the default configurations of the ``file`` handler used for the ``octoprint.log``, the ``serialFile`` handler
used for the ``serial.log`` and the ``console`` handler used for the output to stdout in YAML format below:
.. code-block:: yaml
handlers:
# stdout
console:
class: logging.StreamHandler
level: DEBUG
formatter: simple
stream: ext://sys.stdout
# octoprint.log
file:
class: logging.handlers.TimedRotatingFileHandler
level: DEBUG
formatter: simple
when: D
backupCount: 1
filename: /path/to/octoprints/logs/octoprint.log
# serial.log
serialFile:
class: logging.handlers.RotatingFileHandler
level: DEBUG
formatter: simple
maxBytes: 2097152 # 2 * 1024 * 1024 = 2 MB in bytes
filename: /path/to/octoprints/logs/serial.log
You can find more information on the used logging handlers in the
`Python documentation on logging handlers <https://docs.python.org/2/library/logging.handlers.html>`_.
Changing logging formatters
---------------------------
The logging formatters can be defined via ``logging.yaml`` as well. The ``simple`` formatter as referenced above is
expressed in YAML as follows:
.. code-block:: yaml
formatters:
simple:
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
The possible keys for the logging format can be found in the
`Python documentation on LogRecord attributes <https://docs.python.org/2/library/logging.html#logrecord-attributes>`_.
-224
View File
@@ -1,224 +0,0 @@
.. _sec-configuration-yaml:
A YAML Primer
=============
Most of OctoPrint's configuration is done under the hood through `YAML <https://en.wikipedia.org/wiki/YAML>`_ files,
which is why it makes sense to shed some light on the basics of this data serialization format.
YAML is a text based format which excels at representing the most common of data structures in an easy and very human
readable way, which is why it was chosen for OctoPrint's configuration files. A text editor is all you need in order
to write YAML configuration files.
.. _sec-configuration-yaml-basic:
Basic Rules
-----------
First of all some basic things to know about working with YAML files:
* Never use tabs outside of quoted strings, especially not for indentation. The tab character is illegal within
YAML files.
* Whitespace and indentation matters and plays an important part in structuring the data, so take special care
to stay consistent here.
* YAML's comments start with a ``#`` and go until the end of the line.
.. _sec-configuration-yaml-types:
Interesting data types
----------------------
You will probably only come across the three most basic types of data within OctoPrint's YAML files: scalars
(such as strings, integers, ...), lists and associated arrays (aka key-value-pairs, aka maps, aka dictionaries).
.. _sec-configuration-yaml-types-scalar:
Scalars
.......
Scalars are the most basic of all data types and are simple string, integer, float or boolean values.
For most scalars you don't need any quotes at all, but if you need to define some piece of data which contains characters
that could be mistaken with YAML syntax you need to quote it in either double ``"`` or single ``'`` quotes for the
YAML file to stay valid. As simple rule of thumb, if your data contains any of these characters ``:-{}[]!#|>&%@`` better
quote it. Also quote it if you want a string but it could be mistaken for a valid number (integer or float) or if
it consists only of "Yes", "No", "yes", "no", "true" or "false", which would be converted to a boolean without quotes.
In double quoted strings if you need to include a literal double quote in your string you can escape it by prefixing
it with a backslash ``\`` (which you can in turn escape by itself). In single quoted strings the single quote character
can be escaped by prefixing it with another single quote, basically doubling it. Backslashes in single quoted strings
do not need to be escaped.
Quoted strings can also span across multiple lines, just indent the following lines. Note that you'll need to add a
completely empty line in order for force a line break, the data will not be actually wrapped across multiple lines
just because you spread its representation across multiple lines.
.. _sec-configuration-yaml-types-scalar-int:
int
'''
.. code-block:: yaml
23
42
.. _sec-configuration-yaml-types-scalar-float:
float
'''''
.. code-block:: yaml
23.5
100.0
.. _sec-configuration-yaml-types-scalar-boolean:
boolean
'''''''
.. code-block:: yaml
true
false
Yes
No
yes
no
.. _sec-configuration-yaml-types-scalar-string:
string
''''''
.. code-block:: yaml
a string
"some quoted string with a : colon and a { bracket and a quote \" and a backslash \\ - phew"
'some single quoted string with a single quote '' and a backslash \ - yay'
"and a multiline string - just because we can we'll make it span
across not two but four YAML lines!
Including this paragraph. But in fact it will only be two lines :)"
"23"
"42.3"
"Yes"
"No"
"true"
"false"
yes and no
true or false
.. _sec-configuration-yaml-types-lists:
Lists
.....
Lists allow to "collect" a number of similar things into one data structure. They are created by prefixing one or more
consecutive lines with a ``-``:
.. code-block:: yaml
- item 1
- 23.42
- 57
- true
Take special care to have all of your list items at the same indentation level!
.. _sec-configuration-yaml-types-dicts:
Dictionaries
............
Dictionaries (aka associative arrays aka maps) allow organizing the data in key value pairs, with the key and the value
being separated through a colon ``:``:
.. sourcecode:: yaml
key: value
anotherkey: another value
.. _sec-configuration-yaml-examples:
Examples
--------
Based on the three types explained above, quite complex data structures are possible (whitespace made visible to
help track indentation):
.. code-block-ext:: yaml
:whitespace:
general:
some_setting: some_value
a_list:
- item 1
- 23.42
- 57
- true
some_flag: true
quoted_string: "This string is quoted because {we have this here} and also > this and : that"
specific:
setting1: value1
setting2:
subsetting21: value11
subsetting22:
- subsubsetting221
- subsubsetting222
- subsubsetting223
the_end: yes
In this example we have a dictionary on the top most "layer" which has three keys, ``general``, ``specific`` and
``the_end``.
``general`` in turn is a dictionary with the keys ``some_setting`` (a string), ``a_list`` (a list with four items,
a string, a float, an int and a boolean), ``some_flag`` (a boolean) and ``quoted_string`` (a -- you guessed it -- string).
``specific`` is also a dictionary, with keys ``setting1`` (a string) and ``setting2``, a dictionary with two keys, one
a string and the other again a list.
Finally, ``the_end`` is just a boolean, since an unquoted ``yes`` evaluates as a boolean value as we saw in the
:ref:`section about boolean scalars above <sec-configuration-yaml-types-scalar-boolean>`.
Don't get confused by the list "dividing" one part of the dictionary under ``general`` from the other -- your mind is
just playing a trick on you due to the list's dashes ``-`` being on the same levels as the dictionary keys. You could
also just add two more spaces to your indentation and write that part like this, which makes the structure a bit
clearer (whitespace again made visible to help track indentation):
.. code-block-ext:: yaml
:whitespace:
general:
some_setting: some_value
a_list:
- item 1
- 23.42
- 57
- true
some_flag: true
# ...
Just make sure you follow a consistent way of indenting your files -- YAML is not as strict as Python when it comes to
differing indentation variants within the same file (as long as it's still valid), but consistency will help you as
a lot as a human. Ideally you'll use a text editor which highlights white space characters for you (most editors can
be configured this way), this will help tremendously when editing whitespace sensitive syntax such as YAML.
-218
View File
@@ -1,218 +0,0 @@
.. _sec-development-environment:
Setting up a Development environment
====================================
.. _sec-development-environment-source:
Obtaining, building and running the source
------------------------------------------
This describes the general steps in obtaining, building and running. OS specific instructions can be found
below.
* Prerequisites:
* `Python 2.7 <https://python.org>`_ including ``pip``, ``setuptools`` and ``virtualenv``
* `Git <https://git-scm.com>`_
* Checkout the OctoPrint sources from their Git repository: ``git clone https://github.com/foosel/OctoPrint.git``
* Enter the checked out source folder: ``cd OctoPrint``
* Create a virtual environment in the checked out source folder to use for installing and running OctoPrint and its
dependencies (this avoids potential versioning issues for the dependencies with system wide installed
instances): ``virtualenv venv``
* Activate the virtual environment: ``source venv/bin/activate`` (Linux, MacOS) or
``source venv/Scripts/activate`` (Git Bash under Windows, see below)
* Update ``pip`` in the virtual environment: ``pip install --upgrade pip``
* Install OctoPrint in `"editable" mode <https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>`_,
including its regular *and* development and plugin development dependencies: ``pip install -e .[develop,plugins]``
When the virtual environment is activated you can then:
* run the OctoPrint server via ``octoprint serve``
* run the test suite from the checked out source folder via ``nosetests --with-doctest``
* build the documentation from the ``docs`` sub folder of the checked out sources via ``sphinx-build -b html . _build``
.. _sec-development-environment-source-linux:
Linux
.....
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
First make sure you have python including its header files, pip, setuptools, virtualenv, git and some build requirements
installed:
* On apt based distributions (e.g. Debian, Ubuntu, ...):
.. code-block:: none
sudo apt-get install python python-pip python-dev python-setuptools python-virtualenv git libyaml-dev build-essential
* On zypper based distributions (example below for SLES 12 SP2):
.. code-block:: none
sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/python/SLE_12_SP2/ python_devel
sudo zypper ref
sudo zypper in python python-pip python-devel python-setuptools python-virtualenv git libyaml-devel
sudo zypper in -t pattern Basis-Devel
.. todo::
Using a Linux distribution that doesn't use ``apt`` or ``zypper``? Please send a
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
Then:
.. code-block:: none
cd ~/devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/bin/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
You can then start OctoPrint via ``~/devel/OctoPrint/venv/bin/octoprint`` or just ``octoprint`` if you activated the virtual
environment.
.. _sec-development-environment-windows:
Windows
.......
This assumes you'll host your OctoPrint development checkout at ``C:\Devel\OctoPrint``. If you want to use a different
location, please substitute accordingly.
First download & install:
* `Python 2.7.12 Windows x86 MSI installer <https://www.python.org/downloads/release/python-2712/>`_
* make sure to have the installer add Python to the ``PATH`` and have it install ``pip`` too
* `Microsoft Visual C++ Compiler for Python 2.7 <http://www.microsoft.com/en-us/download/details.aspx?id=44266>`_
* `Git for Windows <https://git-for-windows.github.io/>`_
Open the Git Bash you just installed and in that:
.. code-block:: none
pip install virtualenv
cd /c/Devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source ./venv/Scripts/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
.. _sec-development-environment-mac:
Mac OS X
........
.. note::
This guide is based on the `Setup Guide for Mac OS X on OctoPrint's wiki <https://github.com/foosel/OctoPrint/wiki/Setup-on-Mac/>`_.
Please report back if it works for you, due to lack of access to a Mac I cannot test it myself. Thanks.
This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different
location, please substitute accordingly.
You'll need a user account with administrator privileges.
* Install the latest version of Xcode suitable for your OS. For example, OS X 10.11 (El Capitan) requires Xcode 7.
* Install Xcode's command line tools:
* ``xcode-select --install``
* ``sudo xcodebuild`` (ensure the license was accepted)
* If you have more than one Xcode installed: ``sudo xcode-select -s /Applications/Xcode.app/Contents/Developer``
* Install Homebrew and use that to install Python:
* ``ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"``
* ``brew install python``
* Install `virtualenv <https://virtualenv.pypa.io/>`_
* ``pip install virtualenv``
* Install OctoPrint
.. code-block:: none
cd ~/devel
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv venv
source venv/bin/activate
pip install --upgrade pip
pip install -e .[develop,plugins]
.. _sec-development-environment-ides:
IDE Setup
---------
.. todo::
Using another IDE than the ones below? Please send a
`Pull Request <https://github.com/foosel/OctoPrint/blob/master/CONTRIBUTING.md#pull-requests>`_ to get the necessary
steps into this guide!
.. _sec-development-environment-ides-pycharm:
PyCharm
.......
- "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
- "File" > "Settings ..." > "Project: OctoPrint" > "Project Interpreter" > "Add local ...", select OctoPrint venv
folder (e.g. ``~/devel/OctoPrint/venv`` or ``C:\Devel\OctoPrint\venv``)
- Right click "src" in project tree, mark as source folder
- Add Run/Debug Configuration, select "Python":
* Name: OctoPrint server
* Script: path to ``run`` in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/run`` or ``C:\Devel\OctoPrint\run``)
* Script parameters: ``serve --debug``
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
* If you want dependencies to auto-update on run if necessary: "Before Launch" > "+" > "Run external tool" > "+"
* Name: Update OctoPrint dependencies
* Program: ``$PyInterpreterDirectory$/pip`` (or ``$PyInterpreterDirectory$/pip.exe`` on Windows)
* Parameters: ``install -e .[develop,plugins]``
* Working directory: ``$ProjectFileDir$``
- Add Run/Debug Configuration, select "Python tests" and therein "Nosetests":
* Name: OctoPrint nosetests
* Target: Path, ``.``
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Working directory: the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``)
* Just like with the run configuration for the server you can also have the dependencies auto-update on run of
the tests, see above on how to set this up.
- Add Run/Debug Configuration, select "Python docs" and therein "Sphinx task"
* Name: OctoPrint docs
* Command: ``html``
* Input: the ``docs`` folder in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/docs`` or
``C:\Devel\OctoPrint\docs``)
* Output: the ``docs/_build`` folder in the OctoPrint checkout folder (e.g. ``~/devel/OctoPrint/docs/_build`` or
``C:\Devel\OctoPrint\docs\_build``)
* Project: ``OctoPrint``
* Python interpreter: the ``venv`` local virtual environment
* Just like with the run configuration for the server you can also have the dependencies auto-update when building
the documentation, see above on how to set this up.
.. note::
Make sure you are running a PyCharm version of 2016.1 or later, or manually fix
`a debugger bug contained in earlier versions <https://youtrack.jetbrains.com/issue/PY-18365>`_ or plugin management
will not work in your developer install when running OctoPrint from PyCharm in debug mode.
-11
View File
@@ -1,11 +0,0 @@
.. _sec-development:
###########
Development
###########
.. toctree::
:maxdepth: 3
environment.rst
virtual_printer.rst
-127
View File
@@ -1,127 +0,0 @@
.. _sec-development-virtual-printer:
Setting up the virtual printer for debugging
============================================
OctoPrint includes, by default, a virtual printer plugin. This plugin allows you to debug OctoPrint's serial
communication without connecting to an actual printer. Furthermore, it is possible to create certain edge conditions
that may be hard to reproduce with a real printer.
.. _sec-development-virtual-printer-enable:
Enabling the virtual printer
----------------------------
The virtual printer is enabled by editing OctoPrint's config.yaml file. Details on the configuration file can
be found in the full :ref:`config.yaml documentation <sec-configuration-config_yaml>`.
The steps to take are as follows:
* Find config.yaml in the OctoPrint settings folder. Usually in ``~/.octoprint`` on Linux, in ``%APPDATA%/OctoPrint`` on Windows and in ``~/Library/Application Support/OctoPrint`` on MacOS.
* Add or extend the ``devel`` section with:
.. code-block:: yaml
devel:
virtualPrinter:
enabled: true
* Restart OctoPrint.
* In the connection panel, a new option will appear in the Serial Port dropdown labeled ``VIRTUAL``.
* Select this option and click ``connect``.
* The virtual printer is now active.
.. _sec-development-virtual-printer-config:
Virtual printer configuration options
-------------------------------------
The config.yaml file has many configuration options for the virtual printer that allow you to fine-tune its behavior.
Please see the relevant :ref:`config.yaml section <sec-configuration-config_yaml-devel>` for the full details.
.. _sec-development-virtual-printer-log:
Log file
--------
Once activated, the virtual printer will log all serial communication in the ``plugin_virtual_printer_serial.log`` file
that can be found in the OctoPrint settings folder.
.. _sec-development-virtual-printer-debug:
Debug commands
--------------
You can simulate certain conditions and communications through the terminal tab in OctoPrint's interface.
All commands start with ``!!DEBUG:`` and are followed by the command you want to execute. For instance, sending
``!!DEBUG:action_disconnect`` will disconnect the printer. Sending ``!!DEBUG`` without command will show a help
message with all the available commands:
.. code-block:: none
OctoPrint Virtual Printer debug commands
help
?
| This help.
# Action Triggers
action_pause
| Sends a "// action:pause" action trigger to the host.
action_resume
| Sends a "// action:resume" action trigger to the host.
action_disconnect
| Sends a "// action:disconnect" action trigger to the
| host.
action_custom <action>[ <parameters>]
| Sends a custom "// action:<action> <parameters>"
| action trigger to the host.
# Communication Errors
dont_answer
| Will not acknowledge the next command.
go_awol
| Will completely stop replying
trigger_resend_lineno
| Triggers a resend error with a line number mismatch
trigger_resend_checksum
| Triggers a resend error with a checksum mismatch
trigger_missing_checksum
| Triggers a resend error with a missing checksum
trigger_missing_lineno
| Triggers a "no line number with checksum" error w/o resend request
drop_connection
| Drops the serial connection
prepare_ok <broken ok>
| Will cause <broken ok> to be enqueued for use,
| will be used instead of actual "ok"
# Reply Timing / Sleeping
sleep <int:seconds>
| Sleep <seconds> s
sleep_after <str:command> <int:seconds>
| Sleeps <seconds> s after each execution of <command>
sleep_after_next <str:command> <int:seconds>
| Sleeps <seconds> s after execution of next <command>
# SD printing
start_sd <str:file>
| Select and start printing file <file> from SD
select_sd <str:file>
| Select file <file> from SD, don't start printing it yet. Use
| start_sd to start the print
cancel_sd
| Cancels an ongoing SD print
# Misc
send <str:message>
| Sends back <message>
reset
| Simulates a reset. Internal state will be lost.
+64 -379
View File
@@ -1,11 +1,17 @@
.. _sec-events:
######
Events
######
####################
Events Documentation
####################
.. contents::
With release of OctoPrint 1.1.0, the payload data has been harmonized, it is now a key-value-map for all events.
Additionally, the format of the placeholders in both system command and gcode command triggers has been changed to
accommodate for this new format. Last but not least, the way of specifying event hooks has changed, OctoPrint no longer
separates hooks into two sections (gcodeCommandTrigger and systemCommandTrigger) but instead event hooks are now typed
to indicate what to do with the command contained.
.. _sec-events-configuration:
Configuration
@@ -38,13 +44,6 @@ Example
- event: PrintDone
command: python ~/growl.py -t mygrowlserver -d "Completed {file}" -a OctoPrint -i http://raspi/Octoprint_logo.png
type: system
- event:
- PrintStarted
- PrintFailed
- PrintDone
- PrintCancelled
command: python ~/growl.py -t mygrowlserver -d "Event {__eventname} ({name})" -a OctoPrint -i http://raspi/Octoprint_logo.png
type: system
- event: Connected
command:
- M115
@@ -57,13 +56,10 @@ Example
Placeholders
============
You can use the following generic placeholders in your event hooks:
You can use the following generic placeholders in your events:
* ``{__currentZ}``: the current Z position of the head if known, -1 if not available
* ``{__eventname}`` : the name of the event hook being triggered
* ``{__filename}`` : name of currently selected file, or ``NO FILE`` if no file is selected
* ``{__filepath}`` : path in origin location of currently selected file, or ``NO FILE`` if no file is selected
* ``{__fileorigin}`` : origin of currently selected file, or ``NO FILE`` if no file is selected
* ``{__filename}``: filename of the currently selected file, "NO FILE" if not available
* ``{__progress}``: the progress of the print in percent, 0 if not available
* ``{__data}``: a string representation of the payload
* ``{__now}``: the date and time of the event in ISO 8601
@@ -71,12 +67,10 @@ You can use the following generic placeholders in your event hooks:
Additionally, all data from the payload can be accessed by its key. Example: If the payload happens to be defined
something like this:
* ``name``: the file's name
* ``path``: the file's path in its origin storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``file``: the file's name
* ``origin``: the origin of the file, either ``local`` or ``sdcard``
then you'll be able to access the file's name via the placeholder ``{name}``, its path via the placeholder ``{path}``
and its origin via the placeholder ``{origin}``.
then you'll be able to access the filename via the placeholder ``{file}`` and the origin via the placeholder ``{origin}``.
.. _sec-events-available_events:
@@ -84,20 +78,11 @@ and its origin via the placeholder ``{origin}``.
Available Events
================
.. note::
Plugins may add additional events via the :ref:`octoprint.events.register_custom_events hook <sec-plugins-hook-events-register_custom_events>`.
.. _sec-events-available_events-server:
Server
------
Startup
The server has started.
Shutdown
The server is shutting down.
The server has started
ClientOpened
A client has connected to the web server.
@@ -111,26 +96,9 @@ ClientOpened
ClientClosed
A client has disconnected from the webserver
Payload:
* ``remoteAddress``: the remote address (IP) of the client that disconnected
ConnectivityChanged
The server's internet connectivity changed
Payload:
* ``old``: Old connectivity value (true for online, false for offline)
* ``new``: New connectivity value (true for online, false for offline)
.. _sec-events-available_events-printer_commmunication:
Printer communication
---------------------
Connecting
The server is attempting to connect to the printer.
Connected
The server has connected to the printer.
@@ -139,163 +107,68 @@ Connected
* ``port``: the connected serial port
* ``baudrate``: the baud rate
Disconnecting
The server is going to disconnect from the printer. Note that this
event might not always be sent when the server and printer get disconnected
from each other. Do not depend on this for critical life cycle management.
Disconnected
The server has disconnected from the printer
Error
An unrecoverable error has been encountered, either as reported by the firmware (e.g. a thermal runaway) or
on the connection.
An error has occurred in the printer communication.
Payload:
* ``error``: the error string
PrinterStateChanged
The state of the printer changed.
Payload:
* ``state_id``: Id of the new state. See
:func:`~octoprint.printer.PrinterInterface.get_state_id` for possible values.
* ``state_string``: Text representation of the new state.
.. _sec-events-available_events-file_handling:
File handling
-------------
Upload
A file has been uploaded through the web interface.
A file has been uploaded.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``target``: the target storage location to which the file was uploaded, either ``local`` or ``sdcard``
.. deprecated:: 1.3.0
* ``file``: the file's path within its storage location. To be removed in 1.4.0.
FileAdded
A file has been added to a storage.
Payload:
* ``storage``: the storage's identifier
* ``path``: the file's path within its storage location
* ``name``: the file's name
* ``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]``
.. note::
A copied file triggers this for its new path. A moved file first triggers ``FileRemoved`` for its original
path and then ``FileAdded`` for the new one.
FileRemoved
A file has been removed from a storage.
Payload:
* ``storage``: the storage's identifier
* ``path``: the file's path within its storage location
* ``name``: the file's name
* ``type``: the file's type, a list of the path within the type hierarchy, e.g. ``["machinecode", "gcode"]`` or
``["model", "stl"]``
.. note::
A moved file first triggers ``FileRemoved`` for its original path and then ``FileAdded`` for the new one.
FolderAdded
A folder has been added to a storage.
Payload:
* ``storage``: the storage's identifier
* ``path``: the folder's path within its storage location
* ``name``: the folder's name
.. note::
A copied folder triggers this for its new path. A moved folder first triggers ``FolderRemoved`` for its original
path and then ``FolderAdded`` for the new one.
FolderRemoved
A folder has been removed from a storage.
Payload:
* ``storage``: the storage's identifier
* ``path``: the folder's path within its storage location
* ``name``: the folder's name
.. note::
A moved folder first triggers ``FolderRemoved`` for its original path and then ``FolderAdded`` for the new one.
* ``file``: the file's name
* ``target``: the target to which the file was uploaded, either ``local`` or ``sdcard``
UpdatedFiles
A file list was modified.
Payload:
* ``type``: the type of file list that was modified. Only ``printables`` is supported here. See the deprecation
note below.
* ``type``: the type of file list that was modified. Currently only ``printables`` and ``gcode`` (DEPRECATED) are supported here.
.. deprecated:: 1.2.0
The ``gcode`` modification type has been superseded by ``printables``. It is currently still available for
reasons of backwards compatibility and will also be sent on modification of ``printables``. It will however
be removed with 1.4.0.
.. note::
The type ``gcode`` has been renamed to ``printables`` with the introduction of a new file management layer that
supports STL files as first class citizens as well. For reasons of backwards compatibility the ``UpdatedFiles``
event for printable files will be fired twice, once with ``type`` set to ``gcode``, once set to ``printables``.
Support for the ``gcode`` type will be removed in the next release after version 1.2.0.
MetadataAnalysisStarted
The metadata analysis of a file has started.
The metadata analysis of a GCODE file has started.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the file's origin storage location
* ``file``: the file's name
.. deprecated:: 1.3.0
* ``file``: the file's path within its storage location. To be removed in 1.4.0.
MetadataAnalysisFinished
The metadata analysis of a file has finished.
MetadataAnalaysisFinished
The metadata analysis of a GCODE file has finished.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the file's origin storage location
* ``result``: the analysis result -- this is a Python object currently only available for internal use
.. deprecated:: 1.3.0
* ``file``: the file's path within its storage location. To be removed in 1.4.0.
* ``file``: the file's name
* ``result``: the analysis result -- this is a python object currently only available for internal use
FileSelected
A file has been selected for printing.
A GCODE file has been selected for printing.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
* ``file``: the file's name
* ``origin``: the origin of the file, either ``local`` or ``sdcard``
FileDeselected
No file is selected any more for printing.
TransferStarted
A file transfer to the printer's SD has started.
A GCODE file transfer to SD has started.
Payload:
@@ -305,7 +178,7 @@ TransferStarted
**Note:** Name changed in version 1.1.0
TransferDone
A file transfer to the printer's SD has finished.
A GCODE file transfer to SD has finished.
Payload:
@@ -313,8 +186,6 @@ TransferDone
* ``local``: the file's name as stored locally
* ``remote``: the file's name as stored on SD
.. _sec-events-available_events-printing:
Printing
--------
@@ -323,230 +194,102 @@ PrintStarted
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``user``: the user who started the print job (if available)
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
* ``file``: the file's name
* ``origin``: the origin of the file, either ``local`` or ``sdcard``
PrintFailed
A print failed.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``time``: the elapsed time of the print when it failed, in seconds (float)
* ``reason``: the reason the print failed, either ``cancelled`` or ``error``
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
* ``file``: the file's name
* ``origin``: the origin of the file, either ``local`` or ``sdcard``
PrintDone
A print completed successfully.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``file``: the file's name
* ``origin``: the origin of the file, either ``local`` or ``sdcard``
* ``time``: the time needed for the print, in seconds (float)
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
PrintCancelling
The print is about to be cancelled.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``user``: the user who cancelled the print job (if available)
* ``firmwareError``: the firmware error that caused cancelling the print job, if any
PrintCancelled
The print has been cancelled.
The print has been cancelled via the cancel button.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``time``: the elapsed time of the print when it was cancelled, in seconds (float)
* ``user``: the user who cancelled the print job (if available)
* ``position``: the print head position at the time of cancelling (if available, not available if recording of the
position on cancel is disabled)
* ``position.x``: x coordinate, as reported back from the firmware through `M114`
* ``position.y``: y coordinate, as reported back from the firmware through `M114`
* ``position.z``: z coordinate, as reported back from the firmware through `M114`
* ``position.e``: e coordinate (of currently selected extruder), as reported back from the firmware through `M114`
* ``position.t``: last tool selected *through OctoPrint* (note that if you did change the printer's selected
tool outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will NOT
be accurate)
* ``position.f``: last feedrate for move commands **sent through OctoPrint** (note that if you modified the
feedrate outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will
NOT be accurate)
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
* ``file``: the file's name
* ``origin``: the origin of the file, either ``local`` or ``sdcard``
PrintPaused
The print has been paused.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``user``: the user who paused the print job (if available)
* ``position``: the print head position at the time of pausing (if available, not available if the recording of
the position on pause is disabled or the pause is completely handled by the printer's firmware)
* ``position.x``: x coordinate, as reported back from the firmware through `M114`
* ``position.y``: y coordinate, as reported back from the firmware through `M114`
* ``position.z``: z coordinate, as reported back from the firmware through `M114`
* ``position.e``: e coordinate (of currently selected extruder), as reported back from the firmware through `M114`
* ``position.t``: last tool selected *through OctoPrint* (note that if you did change the printer's selected
tool outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will NOT
be accurate)
* ``position.f``: last feedrate for move commands **sent through OctoPrint** (note that if you modified the
feedrate outside of OctoPrint, e.g. through the printer controller, or if you are printing from SD, this will
NOT be accurate)
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
* ``file``: the file's name
* ``origin``: the origin of the file, either ``local`` or ``sdcard``
PrintResumed
The print has been resumed.
Payload:
* ``name``: the file's name
* ``path``: the file's path within its storage location
* ``origin``: the origin storage location of the file, either ``local`` or ``sdcard``
* ``size``: the file's size in bytes (if available)
* ``owner``: the user who started the print job (if available)
* ``user``: the user who resumed the print job (if available)
.. deprecated:: 1.3.0
* ``file``: the file's full path on disk (``local``) or within its storage (``sdcard``). To be removed in 1.4.0.
* ``filename``: the file's name. To be removed in 1.4.0.
.. _sec-events-available_events-gcode_processing:
* ``file``: the file's name
* ``origin``: the origin of the file, either ``local`` or ``sdcard``
GCODE processing
----------------
PowerOn
An ``M80`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
The GCode has turned on the printer power via M80
PowerOff
An ``M81`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
The GCODE has turned on the printer power via M81
Home
A ``G28`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
The head has gone home via G28
ZChange
The printer's Z-Height has changed (new layer) through a ``G0`` or ``G1`` that was sent to the printer through OctoPrint
(not triggered when printing from SD!)
The printer's Z-Height has changed (new layer)
Dwell
A ``G4`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
Paused
The print has been paused
Waiting
One of the following commands was sent to the printer through OctoPrint (not triggered when printing from SD!):
``M0``, ``M1``, ``M226``
The print is paused due to a gcode wait command
Cooling
An ``M245`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
The GCODE has enabled the platform cooler via M245
Alert
An ``M300`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
The GCODE has issued a user alert (beep) via M300
Conveyor
An ``M240`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
The GCODE has enabled the conveyor belt via M240
Eject
An ``M40`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
The GCODE has enabled the part ejector via M40
EStop
An ``M112`` was sent to the printer through OctoPrint (not triggered when printing from SD!)
PositionUpdate
The response to an ``M114`` was received by OctoPrint. The payload contains the current position information
parsed from the response and (in the case of the selected tool ``t`` and the current feedrate ``f``) tracked
by OctoPrint.
Payload:
* ``x``: x coordinate, parsed from response
* ``y``: y coordinate, parsed from response
* ``z``: z coordinate, parsed from response
* ``e``: e coordinate, parsed from response
* ``t``: last tool selected *through OctoPrint*
* ``f``: last feedrate for move commands ``G0``, ``G1`` or ``G28`` sent *through OctoPrint*
ToolChange
A tool change command was sent to the printer. The payload contains the former current tool index and the
new current tool index.
Payload:
* ``old``: old tool index
* ``new``: new tool index
.. _sec-events-available_events-timelapses:
The GCODE has issued a panic stop via M112
Timelapses
----------
CaptureStart
A timelapse frame has started to be captured.
A timelapse image has started to be captured.
Payload:
* ``file``: the name of the image file to be saved
CaptureDone
A timelapse frame has completed being captured.
A timelapse image has completed being captured.
Payload:
* ``file``: the name of the image file that was saved
CaptureFailed
A timelapse frame could not be captured.
Payload:
* ``file``: the name of the image file that should have been saved
* ``error``: the error that was caught
MovieRendering
The timelapse movie has started rendering.
@@ -574,11 +317,6 @@ MovieFailed
* ``movie``: the movie file that would have been created (full path)
* ``movie_basename``: the movie file that would have been created (only the file name without the path)
* ``returncode``: the return code of ``ffmpeg`` that indicates the error that occurred
* ``reason``: additional machine processable reason string - can be ``returncode`` if ffmpeg
returned a non-0 return code, ``no_frames`` if no frames were captured that could be rendered
to a timelapse, or ``unknown`` for any other reason of failure to render.
.. _sec-events-available_events-slicing:
Slicing
-------
@@ -588,11 +326,8 @@ SlicingStarted
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
* ``gcode_location``: the sliced GCODE's location
* ``progressAvailable``: true if progress information via the ``slicingProgress`` push update will be available, false if not
SlicingDone
@@ -600,11 +335,8 @@ SlicingDone
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
* ``gcode_location``: the sliced GCODE's location
* ``time``: the time needed for slicing, in seconds (float)
SlicingCancelled
@@ -613,67 +345,20 @@ SlicingCancelled
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
* ``gcode_location``: the sliced GCODE's location
SlicingFailed
The slicing of a file has failed.
Payload:
* ``slicer``: the used slicer
* ``stl``: the STL's filename
* ``stl_location``: the STL's location
* ``gcode``: the sliced GCODE's filename
* ``gcode_location``: the sliced GCODE's location
* ``reason``: the reason for the slicing having failed
SlicingProfileAdded
A new slicing profile was added.
Payload:
* ``slicer``: the slicer for which the profile was added
* ``profile``: the profile that was added
SlicingProfileModified
A slicing profile was modified.
Payload:
* ``slicer``: the slicer for which the profile was modified
* ``profile``: the profile that was modified
SlicingProfileDeleted
A slicing profile was deleted.
Payload:
* ``slicer``: the slicer for which the profile was deleted
* ``profile``: the profile that was deleted
.. _sec-events-available_events-settings:
Settings
--------
SettingsUpdated
The settings were updated via the REST API.
This event may also be triggered if calling code of :py:class:`octoprint.settings.Settings.save` or
:py:class:`octoprint.plugin.PluginSettings.save` sets the ``trigger_event`` parameter to ``True``.
.. _sec-events-available_events-printer_profile:
Printer Profile
--------
PrinterProfileModified
A printer profile was modified.
Payload:
* ``identifier``: the identifier of the modified printer profile
The internal settings were updated.
-75
View File
@@ -1,75 +0,0 @@
.. _sec-features-access_control:
Access Control
==============
When Access Control is enabled, anonymous users (not logged in) will only see
the read-only parts of the UI which are the following:
* printer state
* available gcode files and stats (upload is disabled)
* temperature
* webcam
* gcode viewer
* terminal output (sending commands is disabled)
* available timelapse movies
* any components provided through plugins which are enabled for anonymous
users
Logged in users will get access to everything besides the Settings and System
Commands, which are admin-only.
If Access Control is disabled, everything is directly accessible. **That also
includes all administrative functionality as well as full control over the
printer**, and without the need for an :ref:`API key <sec-api-general-authorization>`!
Upon first start a configuration wizard is provided which allows configuration
of the first administrator account or alternatively disabling Access Control
(which is **NOT** recommended for systems that are directly accessible via the
internet or other untrusted networks!).
.. hint::
If you plan to have your OctoPrint instance accessible over the internet,
**always enable Access Control** and ideally **don't make it accessible to
everyone over the internet but instead use a VPN** or at the very least
HTTP basic authentication on a layer above OctoPrint.
A physical device that includes heaters and stepper motors really should not be
publicly reachable by everyone with an internet connection, even with access
control enabled.
.. _sec-features-access_control-rerunning_wizard:
Rerunning the wizard
--------------------
In case Access Control was disabled in the configuration wizard, it is
possible to re-run it by editing ``config.yaml`` [#f1]_ and setting ``firstRun``
in the ``server`` section and ``enabled`` in the ``accessControl`` section to
``true``:
.. code-block-ext:: yaml
accessControl:
enabled: true
# ...
server:
firstRun: true
Then restart the server and connect to the web interface - the wizard should
be shown again.
.. note::
If user accounts were created prior to disabling Access Control and those
user accounts are not to be used any more, remove ``.octoprint/users.yaml``.
If you don't remove this file, the above changes won't lead to the
configuration being shown again, instead Access Control will just be
enabled using the already existing login data. This is to prevent you from
resetting access control by accident.
.. rubric:: Footnotes
.. [#f1] For Linux that will be ``~/.octoprint/config.yaml``, for Windows it will be ``%APPDATA%/OctoPrint/config.yaml`` and for
Mac ``~/Library/Application Support/OctoPrint/config.yaml``
-55
View File
@@ -1,55 +0,0 @@
.. _sec-features-action_commands:
Action Commands
===============
Action commands are a feature defined for the GCODE based RepRap communication protocol. To quote from the
`GCODE node of the RepRap wiki <http://reprap.org/wiki/Gcode#Replies_from_the_RepRap_machine_to_the_host_computer>`_:
The RepRap machine may also send lines that look like this:
**// This is some debugging or other information on a line on its own. It may be sent at any time.**
Such lines will always be preceded by //.
On the latest version of Pronterface and [...] OctoPrint a special comment of the form:
**// action:command**
is allowed to be sent from the firmware[. T]he command can currently be pause, resume or disconnect which will
execute those commands on the host. As this is also a comment other hosts will just ignored these commands.
OctoPrint out of the box supports handling of the above mentioned commands:
cancel
When this command is received from the printer, OctoPrint will cancel a current print job like if the
"Cancel" button had been clicked.
pause
When this command is received from the printer, OctoPrint will pause a current print job just like if the
"Pause" button had been clicked.
paused
When this command is received from the printer, OctoPrint will pause a current print job but *without* triggering
any GCODE scripts or sending SD print control commands to the printer. This might be interesting for firmware
that wants to signal to OctoPrint that a print should be paused but without any control interference from
OctoPrint, e.g. in case of a filament change fully managed by the firmware.
resume
When this command is received from the printer, OctoPrint will resume a current print job just like if
the "Resume" button had been clicked.
resumed
When this command is received from the printer, OctoPrint will resume a current print job but *without* triggering
any GCODE scripts or sending SD print control commands to the printer. This might be interesting for firmware
that wants to signal to OctoPrint that a print should be resumed but without any control interference from
OctoPrint, e.g. in case of a filament change fully managed by the firmware.
disconnect
When this command is received from the printer, OctoPrint will immediately disconnect from it.
If the bundled :ref:`Action Command Prompt Support Plugin <sec-bundledplugins-action_command_prompt>` is enabled (which
should be the case by default), OctoPrint will also interactive dialog creation through its :ref:`supported commands <sec-bundledplugins-action_command_prompt-action_commands>`.
Support for additional commands may be added by plugins by implementing a handler for the
:ref:`octoprint.comm.protocol.action <sec-plugins-hook-comm-protocol-action>` hook.
-30
View File
@@ -1,30 +0,0 @@
.. _sec-features-atcommands:
@ Commands
==========
@ commands (also known as host commands elsewhere) are special commands you may include in GCODE files streamed
through OctoPrint to your printer or send as part of GCODE scripts, through the Terminal Tab, the API or plugins.
Contrary to other commands they will never be sent to the printer but instead trigger functions inside OctoPrint.
They are always of the form ``@<command>[ <parameters>]``, e.g. ``@pause`` or ``@custom_command with some parameters``.
Out of the box OctoPrint supports handling of these commands starting with version 1.3.7:
@cancel
OctoPrint will cancel the current print job like if the "Cancel" button had been clicked. This command doesn't
take any parameters.
@abort
Same as ``cancel``.
@pause
OctoPrint will pause the current print job just like if the "Pause" button had been clicked. This command doesn't
take any parameters.
@resume
OctoPrint will resume the current print job just like if the "Resume" button had been clicked. This command doesn't
take any parameters.
Support for additional commands may be added by plugins by implementing a handler for one of the
:ref:`octoprint.comm.protocol.atcommand <sec-plugins-hook-comm-protocol-atcommand-phase>` hooks.
-297
View File
@@ -1,297 +0,0 @@
.. _sec-features-custom_controls:
Custom Controls
===============
.. contents::
OctoPrint allows you to add custom controls to the "Control" tab of its interface. Control types reach from simple
buttons which trigger sending of one or more lines of GCODE to the printer over more complex controls allowing
parameterization of these commands with values entered by the user to full blown GCODE script templates backed by
`Jinja2 <http://jinja.pocoo.org/>`_.
Custom controls are configured within :ref:`config.yaml <sec-configuration-config_yaml>` [#f1]_ in a ``controls`` section which
basically represents a hierarchical structure of all configured custom controls of various types.
.. note::
To make sure that your ``config.yaml`` stays valid when adding custom controls, don't hesitate to take a look at the
:ref:`YAML Primer <sec-configuration-yaml>`.
The following example defines a control for enabling the cooling fan with a variable speed defined by the user
(default 255 and selectable through a slider UI element) and a control for disabling the fan, all within a section named
"Fan", two example controls with multiple commands in a section "Example for multiple commands", a command with printer
feedback evaluation for the result of the M114 "Get Position" gcode inside a section named "Reporting" and finally
a GCODE script including user input.
.. code-block-ext:: yaml
controls:
- name: Fan
layout: horizontal
children:
- name: Enable Fan
command: M106 S%(speed)s
input:
- name: Speed (0-255)
parameter: speed
default: 255
slider:
min: 0
max: 255
- name: Disable Fan
command: M107
- name: Example for multiple commands
children:
- name: Move X (static)
confirm: You are about to move the X axis right by 10mm with 3000mm/s.
commands:
- G91
- G1 X10 F3000
- G90
- name: Move X (parametric)
commands:
- G91
- G1 X%(distance)s F%(speed)s
- G90
input:
- default: 10
name: Distance
parameter: distance
- default: 3000
name: Speed
parameter: speed
- name: Reporting
children:
- name: Get Position
command: M114
regex: "X:([-+]?[0-9.]+) Y:([-+]?[0-9.]+) Z:([-+]?[0-9.]+) E:([-+]?[0-9.]+)"
template: "Position: X={0}, Y={1}, Z={2}, E={3}"
- name: Fun stuff
children:
- name: Dance
script: custom/dance.gco
input:
- name: Go arounds
parameter: repetitions
slider:
max: 10
min: 1
step: 1
Adding this to ``config.yaml``, restarting the OctoPrint server and switching to the "Control" tab within its
interface yields the visual representation in :numref:`fig-configuration-customcontrols-example`.
.. _fig-configuration-customcontrols-example:
.. figure:: ../images/features-custom_controls-example.png
:align: center
:alt: The rendered output created through the example configuration
The rendered output created through the example configuration
As you can see you have two basic types of control definitions here: controls that actually do something (providing a
button that sends one or more commands to the printer when clicked, displaying output received from the printer) and
controls that just serve as *container* for other controls, the latter being identified by having a ``children``
attribute wrapping more controls.
.. hint::
Take a look at the `Custom Control Editor plugin <http://plugins.octoprint.org/plugins/customControl/>`_
which allows you configuring your Custom Controls through OctoPrint's
settings interface without the need to manually edit the configuration
file.
.. _sec-features-custom_controls-types:
Types
-----
Let's take a closer look at the possible attributes that are available for both basic types.
.. _sec-features-custom_controls-types-containers:
Containers
..........
.. list-table::
:widths: 25 75
* - **Attribute**
- **Description**
* - ``children``
- A list of children controls or containers contained within this container
* - ``name``
- (Optional) A name to display above the container, basically a section header
* - ``layout``
- (Optional) The layout to use for laying out the contained children, either from top to bottom (``vertical``) or
from left to right (``horizontal``). Defaults to a ``vertical`` layout.
.. _sec-features-custom_controls-types-controls:
Controls
........
.. list-table::
:widths: 25 75
* - **Attribute**
- **Description**
* - ``name``
- The name of the control, will be displayed either on the button if it's a control sending a command or as a label
for controls which only display output.
* - ``command``
- (Optional) A single GCODE command to send to the printer. Will be rendered as a button which sends the command to
the printer upon click. The button text will be the value of the ``name`` attribute. Mutually exclusive with
``commands`` and ``script``. The rendered button be disabled if the printer is currently offline or printing or
alternatively if the requirements defined via the ``enabled`` attribute are not met.
* - ``commands``
- (Optional) A list of GCODE commands to send to the printer. Will be rendered as a button which sends the commands
to the printer upon click. The button text will be the value of the ``name`` attribute. Mutually exclusive with
``command`` and ``script``. The rendered button will be disabled if the printer is currently offline or printing
or alternatively if the requirements defined via the ``enabled`` attribute are not met.
* - ``script``
- (Optional) The name of a full blown :ref:`GCODE script <sec-features-gcode_scripts>` to send to the printer.
Will be rendered as a button which sends the script to the printer upon click. The button text will be the value
of the ``name`` attribute. Mutually exclusive with ``command`` and ``commands``. The rendered button will be
disabled if the printer is currently offline or printing or alternatively if the requirements defined via the
``enabled`` attribute are not met.
Values of input parameters will be available in the template context under the ``parameter`` variable (e.g.
an input parameter ``speed`` will be available in the script template as ``parameter.speed``). On top of that all
other variables defined in the :ref:`GCODE template context <sec-features-gcode_scripts-context>` will be available.
:ref:`See below for an example <sec-features-custom_controls-examples-gcode_script>`.
* - ``javascript``
- (Optional) A JavaScript snippet to be executed when the button rendered for ``command`` or ``commands`` is
clicked. This allows to override the direct sending of the command or commands to the printer with more
sophisticated behaviour. The JavaScript snippet is ``eval``'d and processed in a context where the control
it is part of is provided as local variable ``data`` and the ``ControlViewModel`` is available as ``self``.
* - ``additionalClasses``
- (Optional) Additional classes to apply to the button of a ``command``, ``commands``, ``script`` or ``javascript``
control, other than the default ``btn``. Can be used to visually style the button, e.g. set to ``btn-danger`` to
turn the button red.
* - ``enabled``
- (Optional) A JavaScript snippet returning either ``true`` or ``false`` determining whether the control
should be enabled or not. This allow to override the default logic for this (disabled if printer is offline
or currently printing). The JavaScript snippet is ``eval``'d and processed in a context where the control
it is part of is provided as local variable ``data`` and the ``ControlViewModel`` is available as ``self``.
* - ``input``
- (Optional) A list of definitions of input parameters for a ``command`` or ``commands``, to be rendered as
additional input fields. ``command``/``commands`` may contain placeholders to be replaced by the values obtained
from the user for the defined input fields:
.. code-block-ext:: yaml
name: Enable Fan
command: M106 S%(speed)s
input:
- name: Speed (0-255)
parameter: speed
default: 255
slider:
min: 0
max: 255
In OctoPrint's default UI input fields are always rendered left to right (inline).
* - ``input.name``
- Name to display for the input field.
* - ``input.parameter``
- Internal parameter name for the input field, used as a placeholder in ``command``/``commands``.
* - ``input.default``
- Default value for the input field.
* - ``input.slider``
- (Optional) If this attribute is included, instead of an input field a slider control will
be rendered. If you don't want to define any of ``min``, ``max`` or ``step``, write ``slider: {}`` to render
a slider based on default values.
* - ``input.slider.min``
- (Optional) Minimum value of the slider, defaults to 0.
* - ``input.slider.max``
- (Optional) Maximum value of the slider, defaults to 255.
* - ``input.slider.step``
- (Optional) Step size per slider "tick", defaults to 1.
* - ``regex``
- (Optional) A `regular expression <https://docs.python.org/2/library/re.html#regular-expression-syntax>`_ to
match against lines received from the printer to retrieve information from it (e.g. specific output). Together
with ``template`` this allows rendition of received data from the printer within the UI.
* - ``template``
- (Optional) A template to use for rendering the match of ``regex``. May contain placeholders in
`Python Format String Syntax <https://docs.python.org/2/library/string.html#format-string-syntax>`_ for either named
groups within the regex (e.g. ``Temperature: {temperature}`` for a regex ``T:\s*(?P<temperature>\d+(\.\d*)``)
or positional groups within the regex (e.g. ``Position: X={0}, Y={1}, Z={2}, E={3}`` for a regex
``X:([0-9.]+) Y:([0-9.]+) Z:([0-9.]+) E:([0-9.]+)``).
* - ``confirm``
- (Optional) A text to display to the user to confirm his button press. Can be used with sensitive custom controls
like changing EEPROM values in order to prevent accidental clicks. The text will be displayed in a confirmation
dialog like in :numref:`fig-configuration-customcontrols-confirm`.
.. _fig-configuration-customcontrols-confirm:
.. figure:: ../images/features-custom_controls-confirm.png
:align: center
:alt: An example confirmation dialog
An example confirmation dialog
.. _sec-features-custom_controls-examples:
Examples
--------
.. _sec-features-custom_controls-examples-gcode_script:
Parameterized GCODE Script
..........................
.. code-block-ext:: yaml
:caption: Control definition in ~/.octoprint/config.yaml
:name: code-features-custom_controls-example-gcode_script-config_yaml
name: Dance
script: custom/dance.gco
input:
- default: 5
name: Go arounds
parameter: repetitions
slider:
max: 10
min: 1
step: 1
.. code-block-ext:: jinja
:caption: ~/.octoprint/scripts/gcode/custom/dance.gco
:name: code-features-custom_controls-example-gcode_script-dance_gco
{% set center_x = printer_profile.volume.width / 2 %}
{% set center_y = printer_profile.volume.depth / 2 %}
{% set speed_x = printer_profile.axes.x.speed %}
{% set speed_y = printer_profile.axes.y.speed %}
{% set speed_z = printer_profile.axes.z.speed %}
M117 run {{ script.name }}
G4 P500
G1 Z10
G1 X{{ center_x }} Y{{ center_y }} F{{ speed_x }}
M117 let's dance!
G91
G1 X-1 Y-1 F{{ speed_x }}
{% for n in range(parameters.repetitions) %}
M117 and {{ n + 1 }}
{% if n % 2 == 0 %}
G1 Z1 F{{ speed_z }}
G1 Z-2 F{{ speed_z }}
G1 Z1 F{{ speed_z }}
{% endif %}
G1 X2 F{{ speed_x }}
G1 Y2 F{{ speed_y }}
G1 X-2 F{{ speed_x }}
G1 Y-2 F{{ speed_y }}
{% endfor %}
G90
G1 X{{ center_x }} Y{{ center_y }} F{{ speed_x }}
G28 X0 Y0
Note the usage of the ``parameters.repetitions`` template variable in the GCODE script template, which will contain
the value selected by the user for the "Go arounds" slider.
.. rubric:: Footnotes
.. [#f1] For Linux that will be ``~/.octoprint/config.yaml``, for Windows it will be ``%APPDATA%/OctoPrint/config.yaml`` and for
Mac ``~/Library/Application Support/OctoPrint/config.yaml``
-256
View File
@@ -1,256 +0,0 @@
.. _sec-features-gcode_scripts:
GCODE Scripts
=============
.. contents::
OctoPrint allows you to define custom GCODE scripts to be executed on specified occasions, e.g. when a print
starts, when OctoPrint connects to a printer, or when a :ref:`button defined as a custom control <sec-features-custom_controls>`
is clicked.
Unless :ref:`configured otherwise <sec-configuration-config_yaml-folder>`, OctoPrint expects scripts to be located in
the ``scripts/gcode`` folder in OctoPrint configuration directory (per default ``~/.octoprint`` on Linux, ``%APPDATA%\OctoPrint``
on Windows and ``~/Library/Application Support/OctoPrint`` on MacOS).
These GCODE scripts are backed by the templating engine Jinja2, allowing more than just
simple "send-as-is" scripts but making use of a full blown templating language in order to create your scripts. To
this end, OctoPrint injects some variables into the :ref:`template rendering context <sec-features-gcode_scripts-context>`
as described below.
You can find the docs on the Jinja templating engine as used in OctoPrint at `jinja.octoprint.org <http://jinja.octoprint.org/templates.html>`_.
.. note::
Due to backwards compatibility issues with Jinja versions 2.9+, OctoPrint currently only supports Jinja 2.8. For this
reason use the template documentation at `jinja.octoprint.org <http://jinja.octoprint.org/templates.html>`_ instead of the
documentation of current stable Jinja versions.
.. _sec-features-gcode_scripts-predefined:
Predefined Scripts
------------------
The following GCODE scripts are sent by OctoPrint automatically:
* ``afterPrinterConnected``: Sent after OctoPrint successfully connected to a printer. Defaults to an empty script.
* ``beforePrinterDisconnected``: Sent just before OctoPrint (actively) closes the connection to the printer. Defaults
to an empty script. Note that this will *not* be sent for unexpected connection cut offs, e.g. in case of errors
on the serial line, only when the user clicks the "Disconnect" button or the printer requests a disconnect via an
:ref:`action command <sec-features-action_commands>` .
* ``beforePrintStarted``: Sent just before a print job is started. Defaults to an empty script.
* ``afterPrintCancelled``: Sent just after a print job was cancelled. Defaults to the
:ref:`bundled script listed below <sec-features-gcode_scripts-bundled>`.
* ``afterPrintDone``: Sent just after a print job finished. Defaults to an empty script.
* ``afterPrintPaused``: Sent just after a print job was paused. Defaults to an empty script.
* ``beforePrintResumed``: Sent just before a print job is resumed. Defaults to an empty script.
.. note::
Plugins may extend these scripts through :ref:`a hook <sec-plugins-hook-comm-protocol-scripts>`.
.. _sec-features-gcode_scripts-snippets:
Snippets
--------
For making small GCODE snippets reusable in a template (e.g. for :ref:`disabling all hotends <sec-features-gcode_scripts-bundled>`)
there's an additional Jinja template command ``{% snippet '<snippet name>' %}`` available which allows including
snippets stored under ``scripts/gcode/snippets`` in OctoPrint's configuration directory. They fully support
the whole spectrum of the Jinja2 templating language (that includes including other snippets).
.. _sec-features-gcode_scripts-context:
Context
-------
All GCODE scripts have access to the following template variables through the template context:
* ``printer_profile``: The currently selected :ref:`Printer Profile <sec-modules-printer-profile>`, including
information such as the extruder count, the build volume size, the filament diameter etc.
* ``last_position``: Last position reported by the printer via `M114` (might be unset if no `M114` was sent so far!).
Consists of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and
current tool ``t`` taken from commands sent through OctoPrint. All of these coordinates might be ``None`` if no
position could be retrieved from the printer or the values could not be tracked (in case of ``f`` and ``t``)!
* ``last_temperature``: Last actual and target temperature reported for all available tools and if available the
heated bed. This is a dictionary of key-value pairs. The keys are the indices of the available tools (``0``, ``1``,
...) and ``b`` for the heated bed. The values are a dictionary consisting of ``actual`` and ``target`` keys mapped
to the corresponding temperature in degrees Celsius. Note that not all tools your printer has must necessarily be
present here, neither must the heated bed - it depends on whether OctoPrint has values for a tool or the bed. Also
note that ``actual`` and ``target`` might be ``None``.
* ``script``: An object wrapping the script's type (``gcode``) and name (e.g. ``afterPrintCancelled``) as ``script.type``
and ``script.name`` respectively.
* ``plugins``: An object containing variables provided by plugins (e.g ``plugins.myplugin.myvariable``)
There are a few additional template variables available for the following specific scripts:
* ``afterPrintPaused`` and ``beforePrintResumed``
* ``pause_position``: Position reported by the printer via ``M114`` immediately before the print was paused. See
``last_position`` above for the structure to expect here.
**Please note:** This will not be available if you disable
"Log position on pause" under Settings > Serial > Advanced options!
* ``pause_temperature``: Last known temperature values when the print was paused. See ``last_temperature`` above
for the structure to expect here.
* ``afterPrintCancelled``
* ``cancel_position``: Position reported by the printer via ``M114`` immediately before the print was cancelled.
See ``last_position`` above for the structure to expect here.
**Please note:** This will not be available if you disable
"Log position on cancel" under Settings > Serial > Advanced options!
* ``cancel_temperature``: Last known temperature values when the print was cancelled. See ``last_temperature`` above
for the structure to expect here.
.. warning::
Note that current firmware implementations only report back one ``E`` value, the current extrusion value for the current
extruder. Retrieving all ``E`` values by cycling through all extruders on pause and cancel is something OctoPrint
currently does NOT do since it would simply take too long. That means that if you want to write a ``beforePrintResumed``
script that basically resets everything back to the point when the printer was paused *and* you are running with
multiple extruders, you'll have to find some other way to have your ``E`` values set correctly for all your available
extruders - the data available in ``pause_position`` will *not* suffice. Additionally, most firmwares don't report
the currently selected tool in the ``M114`` response, meaning that the only way OctoPrint can keep track of that is
by tracking it itself. Same goes for the current feed rate ``F``. So if you are printing from SD, this data will be
*wrong*. This is also the reason why OctoPrint currently doesn't bundle a more sophisticated pause and resume script
that would actually move the print head out of the way and pause and back to the original position on resume - it
might cause issues for the multitude of users out there with multi-extruder setups or for people printing from the
printer's SD, thanks to the lack of information the firmware provides.
The :ref:`predefined GCODE scripts <sec-features-gcode_scripts-predefined>` are also called with the following additional
template variables:
* ``event``: The payload of the ``Connected``, ``PrintStarted``, ``PrintCancelled``, ``PrintDone``, ``PrintPaused`` or
``PrintResumed`` event. See :ref:`the documentation of events <sec-events-available_events>` for the contained values.
GCODE scripts attached to :ref:`custom controls <sec-features-custom_controls>` are called with the following
additional template variables:
* ``parameters``: The parameters as defined for the custom control, if it has any inputs.
* ``context``: Additional ``context`` included in the definition of the custom control.
.. _sec-features-gcode_scripts-bundled:
Bundled Scripts
---------------
Out of the box, OctoPrint defaults to the following script setup for ``afterPrintCancelled``:
.. code-block:: jinja
:caption: Default ``afterPrintCancelled`` script
; disable motors
M84
;disable all heaters
{% snippet 'disable_hotends' %}
{% snippet 'disable_bed' %}
;disable fan
M106 S0
The ``disable_hotends`` snippet is defined as follows:
.. code-block:: jinja
:caption: Default ``disable_hotends`` snippet
{% if printer_profile.extruder.sharedNozzle %}
M104 T0 S0
{% else %}
{% for tool in range(printer_profile.extruder.count) %}
M104 T{{ tool }} S0
{% endfor %}
{% endif %}
The ``disable_bed`` snippet is defined as follows:
.. code-block:: jinja
:caption: Default ``disable_bed`` snippet
{% if printer_profile.heatedBed %}
M140 S0
{% endif %}
As you can see, the ``disable_hotends`` and ``disable_bed`` snippets utilize the
``printer_profile`` context variable in order to iterate through all available
extruders and set their temperature to 0, and to also set the bed temperature
to 0 if a heated bed is configured.
.. _sec-features-gcode_scripts-examples:
Examples
--------
.. _sec-features-gcode_scripts-examples-more_nifty_pause_and_resume:
More nifty pause and resume
...........................
If you do not have a multi-extruder setup, aren't printing from SD and have "Log position on pause" enabled under
Settings > Serial > Advanced options, the following ``afterPrintPaused`` and
``beforePrintResumed`` scripts might be interesting for you. With something like them in place, OctoPrint will move your print head
out of the way to a safe rest position (here ``G1 X0 Y0``, you might want to adjust that) on pause and move it back
to the persisted pause position on resume, making sure to also reset the extruder and feedrate.
.. code-block:: jinja
:caption: ``afterPrintPaused`` script
{% if pause_position.x is not none %}
; relative XYZE
G91
M83
; retract filament, move Z slightly upwards
G1 Z+5 E-5 F4500
; absolute XYZE
M82
G90
; move to a safe rest position, adjust as necessary
G1 X0 Y0
{% endif %}
.. code-block:: jinja
:caption: ``beforePrintResumed`` script
{% if pause_position.x is not none %}
; relative extruder
M83
; prime nozzle
G1 E-5 F4500
G1 E5 F4500
G1 E5 F4500
; absolute E
M82
; absolute XYZ
G90
; reset E
G92 E{{ pause_position.e }}
; move back to pause position XYZ
G1 X{{ pause_position.x }} Y{{ pause_position.y }} Z{{ pause_position.z }} F4500
; reset to feed rate before pause if available
{% if pause_position.f is not none %}G1 F{{ pause_position.f }}{% endif %}
{% endif %}
.. warning::
As mentioned in the warning above and the description of the example itself, this will *only* work if you are
not printing from SD and not using multiple extruders since OctoPrint will only then be able to track the
necessary position data and print parameters due to firmware limitations.
.. seealso::
`Jinja Template Designer Documentation <http://jinja.octoprint.org/templates.html>`_
Jinja's Template Designer Documentation describes the syntax and semantics of the template language used
also by OctoPrint's GCODE scripts. Linked here are the docs for Jinja 2.8.1, which OctoPrint still
relies on for backwards compatibility reasons.
-20
View File
@@ -1,20 +0,0 @@
.. _section-features:
********
Features
********
.. note::
This feature list is not exhaustive. This part of OctoPrint's documentation is sadly far from finished still.
.. toctree::
:maxdepth: 2
accesscontrol.rst
custom_controls.rst
gcode_scripts.rst
action_commands.rst
atcommands.rst
plugins.rst
safemode.rst
-80
View File
@@ -1,80 +0,0 @@
.. _sec-features-plugins:
*******
Plugins
*******
Starting with OctoPrint 1.2.0, there's now a plugin system in place which allows to individually
extend OctoPrint's functionality.
Right now plugins can be used to extend OctoPrint's web interface, to execute specific tasks on server startup and
shutdown, to provide custom (API) endpoints or whole user interfaces with special functionality, to react to system
events or progress reports or to add support for additional slicers. More plugin types are planned for the future.
.. note::
Since a plugin might not function properly and cause issues that are hard to diagnose or outright disrupt server
functionality, you might want to be able to start OctoPrint without any third party plugins enabled. This is also
very important when reporting bugs in OctoPrint, to ensure that what you are observing is actually a bug in
OctoPrint and not in any of your installed third party plugins.
To do that, OctoPrint has a built-in safe mode that disables all plugins not shipped as part of OctoPrint. You can
read more on how to enable that :ref:`here <sec-features-safemode>`.
.. _sec-features-plugins-available:
Finding Plugins
===============
The official OctoPrint Plugin Repository can be found at `plugins.octoprint.org <http://plugins.octoprint.org>`_.
Some plugins may also be found in the list provided in `the OctoPrint wiki <https://github.com/foosel/OctoPrint/wiki#plugins>`_
and on the `OctoPrint organization Github page <https://github.com/OctoPrint>`_.
.. _sec-features-plugins-installing:
Installing Plugins
==================
Plugins can be installed through the bundled Plugin Manager, which allows installing plugins available in the
`OctoPrint Plugin Repository <http://plugins.octoprint.org>`_, from a web address or from an uploaded file archive.
Please refer to the documentation of the plugin for additional installations instructions.
Manual Installation
-------------------
If you don't want or can't use the Plugin Manager, plugins may also be installed manually either by copying and
unpacking them into one of the configured plugin folders (regularly those are ``<octoprint source root>/plugins`` and
``<octoprint config folder>/plugins`` [#f1]_ or by installing them as regular Python modules via ``pip`` [#f2]_.
For a plugin available on the Python Package Index (PyPi), the process is as simple as issuing a
.. code-block:: bash
pip install <plugin_name>
For plugins not available on PyPi, you'll have to give ``pip`` an URL from which to install the package (e.g. the URL to
a ZIP file of the current master branch of a Github repository hosting a plugin, or even a ``git+https`` URL), example:
.. code-block:: bash
pip install https://github.com/OctoPrint/OctoPrint-Growl/archive/master.zip
See `the pip install documentation <http://pip.readthedocs.org/en/latest/reference/pip_install.html>`_ for what URL
types are possible.
.. _sec-features-plugins-developing:
Developing Plugins
==================
See :ref:`Developing Plugins <sec-plugins>`.
.. rubric:: Footnotes
.. [#f1] For Linux that will be ``~/.octoprint/plugins``, for Windows it will be ``%APPDATA%/OctoPrint/plugins`` and for
Mac ``~/Library/Application Support/OctoPrint/plugins``
.. [#f2] Make sure to use the exact same Python installation for installing the plugin that you also used for
installing & running OctoPrint. For OctoPi this means using ``~/oprint/bin/pip`` for installing plugins
instead of just ``pip``.
-89
View File
@@ -1,89 +0,0 @@
.. _sec-features-safemode:
*********
Safe mode
*********
With the advent of support for plugins in OctoPrint, it quickly became apparent that some of the bugs
reported on OctoPrint's bug tracker were actually bugs with installed third party plugins instead of
OctoPrint itself.
To allow an easier identification of these cases, OctoPrint 1.3.0 introduced safe mode. Starting
OctoPrint in safe mode disables all plugins that are not bundled with OctoPrint, allowing to easier
identify most cases where a third party plugin is the culprit of an observed issue.
Additionally, OctoPrint allows uninstalling plugins in this mode, allowing recovery from cases where
a third party plugin causes the server to not start up or the web interface to not render or function
correctly anymore.
Whenever reporting an issue with OctoPrint, please always attempt to reproduce it in safe mode as well to
ensure it really is an issue in OctoPrint itself and now caused by one of your installed third party plugins.
.. _sec-features-safemode-how:
How to start OctoPrint in safe mode
===================================
There exist three ways to start OctoPrint in safe mode:
* by selecting "Restart OctoPrint in safe mode" from the "System" menu,
if the "Restart OctoPrint" server command has been correctly configured (since OctoPrint 1.3.2,
see :numref:`fig-features-safemode-systemmenu`)
* by setting the flag ``server.startOnceInSafeMode`` in :ref:`config.yaml <sec-configuration-config_yaml>`
to ``true`` and restarting. To set this flag you have the following options:
* from command line run ``octoprint safemode`` (since OctoPrint 1.3.6)
* from command line run ``octoprint config set --bool server.startOnceInSafeMode true`` (fixed in OctoPrint 1.3.6)
* use the `Yamlpatcher Plugin <http://plugins.octoprint.org/plugins/yamlpatcher/>`_ and enter & apply the patch
``[["set", "server.startOnceInSafeMode", true]]``
* edit ``config.yaml`` manually with a text editor, locate the ``server`` block if it already exists or create it
if it doesn't and add ``startOnceInSafeMode: true`` to it:
.. code-block:: yaml
# ...
server:
startOnceInSafeMode: true
# ...
Please also refer to the :ref:`YAML primer <sec-configuration-yaml>`.
* by starting OctoPrint with the command line parameter ``--safe``, e.g. ``octoprint serve --safe`` (don't forget to
shutdown OctoPrint first before doing this)
The last two options will have OctoPrint enable safe mode only for the next server start - once you
restart OctoPrint again, safe mode will be disabled again.
.. note::
**OctoPi users**: For you that's ``~/oprint/bin/octoprint`` wherever it says just ``octoprint``.
.. _fig-features-safemode-systemmenu:
.. figure:: ../images/features-safemode-systemmenu.png
:align: center
:alt: "Restart OctoPrint in safe mode" in the "System" menu
"Restart OctoPrint in safe mode" in the "System" menu
.. _sec-features-safemode-differences:
Differences of safe mode vs normal operation mode
=================================================
When OctoPrint is running in safe mode the following changes to its normal operation mode apply:
* OctoPrint will not enable any of the installed third party plugins. OctoPrint considers all plugins third
party plugins that do not ship with OctoPrint's sources, so any plugins installed either via `pip` or
into OctoPrint's plugin folder at ``~/.octoprint/plugins`` (Linux), ``%APPDATA%/OctoPrint`` (Windows) and
``~/Library/Application Support/OctoPrint`` (MacOS).
* OctoPrint will still allow to uninstall third party plugins through the built-in Plugin Manager.
* OctoPrint will still allow to disable (bundled) plugins that are still enabled.
* OctoPrint will not allow to enable third party plugins.
* OctoPrint's web interface will display a notification to remind you that it is running in
safe mode.
.. _fig-features-safemode-notification:
.. figure:: ../images/features-safemode-notification.png
:align: center
:alt: Safe mode notification
Safe mode notification
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Loaded 100 of 689 files, more files were not shown because too many files have changed in this diff. Show more