/
openapi-legacy.yaml
2426 lines (2332 loc) · 67.4 KB
/
openapi-legacy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.1
info:
title: Prusa Link Web
description:
This is a printer connect webservice. It is compatible with another 3D
printer services, so many applications which use this service
contact:
email: developer@prusa3d.cz
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 2.0.0
externalDocs:
description: Find out more about API
url: http://connect.prusa3d.cz
security:
- ApiKeyAuth: [developer]
paths:
/api/version:
get:
summary: version informations
parameters:
- in: query
name: system
required: false
description: If system versions must be returned.
schema:
type: boolean
default: false
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
api:
type: string
example: "0.1"
server:
type: string
example: "1.1.0"
description: "Firmware on Prusa-Link version"
original:
type: string
example: "PrusaLink I3MK3S"
text:
type: string
example: "OctoPrint 1.1.0"
hostname:
type: string
example: "prusa-sl1"
firmware:
type: string
description: "Firmaware version"
example: "3.10.0"
sdk:
type: string
example: "0.2.0"
# platform dependent
python:
type: array
items:
type: object
properties:
name:
type: string
example: "urllib3"
version:
type: string
example: "1.26.1"
path:
type: string
example: "/usr/lib/python3/dist-packages"
# platform dependent
system:
type: object
properties:
python:
type: string
DESCRIPTION:
type: string
ID:
type: string
example: "Raspbian"
OS:
type: string
example: "GNU/Linux"
/api/connection:
get:
summary: Retrieve a mock for current connection settings.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
current:
$ref: "#/components/schemas/ConnCurrent"
options:
$ref: "#/components/schemas/ConnOptions"
connect:
$ref: "#/components/schemas/ConnConfig"
states:
$ref: "#/components/schemas/ConnStates"
403:
$ref: "#/components/responses/Unauthorized"
post:
summary: Issue a connection command
requestBody:
content:
application/json:
schema:
type: object
properties:
# platform dependent
command:
type: string
default: connect
# platform dependent
baudrate:
type: integer
default: 115200
# platform dependent
port:
type: string
default: VIRTUAL
# platform dependent
printerProfile:
type: string
default: _default
# platform dependent
connect:
type: object
properties:
hostname:
type: string
example: "connect.prusa3d.com"
port:
type: integer
default: 0
tls:
type: boolean
default: true
responses:
# Return 200 only, if connect is filled
200:
description: OK
content:
application/json:
schema:
type: object
properties:
url:
type: string
example: "http://dev.connect.prusa:8080/add-printer/connect/1.3.1/AHWAXF7JZI/Shelf/Home"
204:
description: No Content
No Error
403:
$ref: "#/components/responses/Unauthorized"
# platform dependent
/api/printerprofiles:
get:
summary: Retrive a mock of octoprinter printer profile
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
profiles:
$ref: "#/components/schemas/Profiles"
403:
$ref: "#/components/responses/Unauthorized"
/api/printer:
get:
summary: Retrive the current printer state
parameters:
- in: query
name: exclude
description: A list of attributes to not return in the response.
schema:
type: array
items:
type: string
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
temperature:
$ref: "#/components/schemas/TemperatureState"
sd:
$ref: "#/components/schemas/SDState"
state:
$ref: "#/components/schemas/PrinterState"
telemetry:
oneOf:
- $ref: "#/components/schemas/TelemetryFDM"
- $ref: "#/components/schemas/TelemetryMini"
- $ref: "#/components/schemas/TelemetrySL1"
403:
$ref: "#/components/responses/Unauthorized"
/api/printer/sd:
get:
summary: Retrieves the current state of the printer’s SD card.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/SDState"
403:
$ref: "#/components/responses/Unauthorized"
/api/printer/printhead:
post:
summary: Control printhead movement in XYZ axes
requestBody:
content:
application/json:
schema:
type: object
properties:
jog:
type: object
properties:
command:
type: string
example: "jog"
x:
type: number
example: 10
y:
type: number
example: -5
z:
type: number
example: 0.02
home:
type: object
properties:
command:
type: string
example: "home"
axes:
type: array
items:
type: string
example: "X"
speed:
type: object
properties:
command:
type: string
example: "speed"
factor:
type: number
example: 105
feedrate:
type: object
properties:
command:
type: string
example: "feedrate"
factor:
type: number
example: 105
disable_steppers:
type: object
properties:
command:
type: string
example: "disable_steppers"
responses:
204:
description: No Content
No Error
400:
$ref: "#/components/responses/BadRequest"
409:
$ref: "#/components/responses/Conflict"
/api/printer/tool:
post:
summary: Control extruder
requestBody:
content:
application/json:
schema:
type: object
properties:
target:
type: object
properties:
command:
type: string
example: "target"
targets:
type: object
properties:
tool0:
type: number
example: 220
offset:
type: object
properties:
command:
type: string
example: "offset"
offsets:
type: object
properties:
tool0:
type: number
example: 10
select:
type: object
properties:
command:
type: string
example: "select"
tool:
type: string
example: "tool0"
extrude:
type: object
properties:
command:
type: string
example: "extrude"
amount:
type: number
example: 5
retract:
type: object
properties:
command:
type: string
example: "extrude"
amount:
type: number
example: -3
flowrate:
type: object
properties:
command:
type: string
example: "flowrate"
amount:
type: number
example: 95
responses:
204:
description: No Content
No Error
400:
$ref: "#/components/responses/BadRequest"
409:
$ref: "#/components/responses/Conflict"
/api/printer/bed:
post:
summary: Control bed temperature
requestBody:
content:
application/json:
schema:
type: object
properties:
command:
type: string
example: "target"
target:
type: number
example: 75
responses:
204:
description: No Content
No Error
400:
$ref: "#/components/responses/BadRequest"
409:
$ref: "#/components/responses/Conflict"
# MK3
# - not supporting this endpoint
# MINI
# - will probably not support this endpoint.
# - On error sends plaintext error description in response body
# - On error possibly sends Content-Location header with URL to help.prusa3d.com.
# - PCL page /error will be ommited
# SL1
# - supports this endpoint
# - Response is dependent on Accept header in request
# - If no Accept header is present:
# - sends plaintext error description in response body (compatibility with older slicer)
# - sends Content-Location header with URL to <PCL IP>/error (in the future it may send URL to hlep.prusa3d.com)
# - if Accept header is present (currently supports only Accept: application/json):
# - sends JSON with same content as this /api/printer/error endpoint (code, title, text, url)
# sends Content-Location header with URL to <PCL IP>/error (in the future it may send URL to hlep.prusa3d.com)
/api/printer/error:
get:
summary: Retrive the error number and text. Not compatible with OctoPrint.
responses:
200:
description: Custom endpoint to get error details. Client can see if printer is in error state by polling /api/printer
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
403:
$ref: "#/components/responses/Unauthorized"
/api/job: # this should be used instead of /files/preview to determine if project was selected. If "file" object is not null, project was previously selected
get:
summary: Retrieve information about the current job (if there is one).
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
job:
$ref: "#/components/schemas/Job"
progress:
$ref: "#/components/schemas/Progress"
state:
$ref: "#/components/schemas/State"
403:
$ref: "#/components/responses/Unauthorized"
409:
$ref: "#/components/responses/Conflict"
description: File not found or wrong format.
post:
summary: Issue a job command.
requestBody:
content:
application/json:
schema:
type: object
properties:
command:
type: string
enum: ["start", "restart", "pause", "cancel"]
default: start
action:
type: string
enum: [pause, resume]
default: resume
responses:
204:
description: No Content
No Error
403:
$ref: "#/components/responses/Unauthorized"
409:
$ref: "#/components/responses/Conflict"
description: If not is project, file not found or printer is printing.
501:
$ref: "#/components/responses/NotImplemented"
description: Unsupported command.
/api/system/commands:
get:
summary: Retrieves all configured system commands.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Commands"
403:
$ref: "#/components/responses/Unauthorized"
/api/system/commands/core/reboot:
post:
summary: Execute system reboot.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
400:
description: Bad request
content:
application/json:
schema:
type: object
403:
$ref: "#/components/responses/Unauthorized"
/api/system/commands/core/restart:
post:
summary: Trigger restarting of Prusa-Link.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
400:
description: Bad request
content:
application/json:
schema:
type: object
403:
$ref: "#/components/responses/Unauthorized"
/api/system/commands/core/shutdown:
post:
summary: Shutdown whole system.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
400:
description: Bad request
content:
application/json:
schema:
type: object
403:
$ref: "#/components/responses/Unauthorized"
/api/system/commands/custom/changeexposure:
post:
summary: Change the exposure times
requestBody:
content:
application/json:
schema:
type: object
properties:
exposureTime: # [ms]
type: integer
example: 6000
nullable: true
exposureTimeFirst: # [ms]
type: number
example: 30000
nullable: true
exposureTimeCalibration: # [ms]
type: number
example: 30000
nullable: true
exposureUserProfile: # [-]
type: number
example: 1
nullable: true
responses:
204:
description: No Content
No Error
/api/system/commands/custom/resinrefill:
post:
summary: Update remaining resing in the printer.
responses:
204:
description: No Content
No Error
/api/access/users:
get:
summary: Retrieves a list of all registered users in OctoPrint. Currently just a mock.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
users:
type: array
items:
$ref: "#/components/schemas/Users"
403:
$ref: "#/components/responses/Unauthorized"
/api/settings:
get:
summary: Returns printer settings info
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
api-key:
type: string
printer:
type: object
properties:
name:
type: string
location:
type: string
farm_mode:
type: boolean
network_error_chime:
type: boolean
post:
summary: Sets new printer and/or user settings and writes it to ini file
requestBody:
content:
application/json:
schema:
type: object
properties:
printer:
type: object
properties:
name:
type: string
location:
type: string
user:
type: object
properties:
password:
type: string
username:
type: string
new_password:
type: string
new_repassword:
type: string
farm_mode:
type: boolean
network_error_chime:
type: boolean
responses:
200:
description: OK
400:
description: Bad Request
content:
application/json:
schema:
type: object
properties:
errors:
type: object
properties:
printer:
type: object
properties:
missing_credentials:
type: boolean
user:
type: object
properties:
username:
type: boolean
password:
type: boolean
repassword:
type: boolean
old_digest:
type: boolean
same_digest:
type: boolean
/api/settings/apikey:
get:
summary: Regenerate api key and save it to settings and config file
responses:
200:
description: OK
content:
application/json:
schema:
type: object
/api/settings/sn:
post:
summary: If printer is in SN error, user can insert new SN
requestBody:
content:
application/json:
schema:
type: object
properties:
serial:
type: string
example: "CZPX4242X042XC42042"
responses:
200:
description: OK
400:
$ref: "#/components/responses/BadRequest"
409:
$ref: "#/components/responses/Conflict"
507:
description: Insufficient Storage
/api/files/{target}/{path}:
parameters:
- in: path
name: target
required: true
description: The target location of the file (local, sdcard).
schema:
type: string
default: local
enum:
- local
- sdcard
- in: path
name: path
required: true
description: The path to the file.
schema:
type: string
get:
summary: Returns metadata from cache file
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
origin:
type: string
example: "local"
name:
type: string
example: "castle.gcode"
path:
type: string
example: "/Prusa Link gcodes/castle.gcode"
type:
type: string
example: "machinecode"
typePath:
type: array
items:
type: string
example: ["machinecode", "gcode"]
refs:
type: object
properties:
resource:
type: string
example: "/api/files/local/Prusa Link gcodes/castle.gcode"
download:
type: string
example: "/api/files/local/Prusa Link gcodes/castle.gcode/raw"
thumbnailSmall:
type: string
example: null
thumbnailBig:
type: string
example: "/api/thumbnails/Prusa Link gcodes/castle.gcode.orig.png"
size:
type: integer
example: 177514
date:
type: integer
example: 1648038843
gcodeAnalysis:
type: object
properties:
estimatedPrintTime:
type: integer
example: 207
material:
type: string
example: "PLA"
layerHeight:
type: number
example: 0.3
404:
$ref: "#/components/responses/NotFound"
post:
summary: Start print if no print job is running.
requestBody:
content:
application/json:
schema:
type: object
properties:
command:
type: string
example: "select"
print:
type: boolean
example: true
required:
- select
responses:
204:
description: No Content
No Error
400:
$ref: "#/components/responses/BadRequest"
409:
$ref: "#/components/responses/Conflict"
delete:
summary: Terminate the current file download process.
responses:
204:
description: No Content
No Error
409:
$ref: "#/components/responses/Conflict"
/api/files/{target}/{path}/raw:
parameters:
- in: path
name: target
required: true
description: The target location from which to download the file (local, sdcard).
schema:
type: string
default: local
enum:
- local
- sdcard
- in: path
name: path
required: true
description: The path to the file.
schema:
type: string
get:
summary: Downloads intended gcode
responses:
200:
description: OK
content:
application/octet-stream:
schema:
type: string
format: binary
404:
$ref: "#/components/responses/NotFound"
/api/downloads/{target}/{filename}:
parameters:
- in: path
name: target
required: true
description: The target location to which to download the file (local, sdcard).
schema:
type: string
default: local
enum:
- local
- sdcard
- in: path
name: filename
required: true
description: The path within the location to download the file.
schema:
type: string
get:
summary: Download a file.
responses:
200:
description: OK
content:
application/octet-stream:
schema:
type: string
format: binary
403:
$ref: "#/components/responses/Unauthorized"
404:
$ref: "#/components/responses/NotFound"
415:
$ref: "#/components/responses/UnsupportedMediaType"
# Ony for compatibility, use /api/transfer where possible
/api/download:
get:
summary: Get information about the file currently being transferred.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
type:
type: string
enum: [ "NO_TRANSFER", "FROM_WEB", "FROM_CONNECT", "FROM_PRINTER", "FROM_SLICER", "FROM_CLIENT", "TO_CONNECT", "TO_CLIENT"]
example: "FROM_WEB"
url:
type: string
example: "https://www.prusaprinters.org/castle.gcode"
target:
type: string
example: "local"
destination:
type: string
example: "/Prusa Link gcodes/castle.gcode"
path:
type: string
example: "/Prusa Link gcodes/castle.gcode"
size:
type: string
example: "68073825"
start_time:
type: string
example: "1620292282"
progress:
type: string
example: "0.95"
remaining_time:
type: string
example: "281.92677480085825"
to_select:
type: boolean
to_print:
type: boolean
204:
description: No Content
No Error
403:
$ref: "#/components/responses/Unauthorized"
delete:
summary: Terminate the current file download process.
responses:
204:
description: No Content
No Error
/api/transfer:
get:
summary: Get information about the file currently being transferred.
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
type:
type: string
example: "FROM_WEB"
url:
type: string
example: "https://www.prusaprinters.org/castle.gcode"
target:
type: string
example: "local"
destination:
type: string
example: "/Prusa Link gcodes/castle.gcode"
path:
type: string
example: "/Prusa Link gcodes/castle.gcode"
size:
type: string
example: "68073825"
start_time:
type: string
example: "1620292282"
progress:
type: string