-
Notifications
You must be signed in to change notification settings - Fork 550
/
Copy pathOpenAPI.yaml
602 lines (597 loc) · 26.6 KB
/
OpenAPI.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
openapi: 3.0.0
info:
version: '3.6.0'
title: 'RepRapFirmware'
license:
name: GPL-3.0
paths:
/rr_connect:
get:
summary: |
Attempt to create a new connection and log in using the (optional) password
parameters:
- name: password
in: query
description: 'Password'
required: false
schema:
type: string
format: password
- name: 'time'
in: query
description: 'Current datetime that will be used to update RepRapFirmware''s internal clock'
required: false
schema:
type: string
format: 'date-time'
responses:
'200':
description: 'Connect response'
content:
application/json:
schema:
type: object
properties:
err:
description: 'Error code (0 = success, 1 = invalid password, 2 = no more sessions available)'
type: number
minimum: 0
maximum: 2
sessionTimeout:
type: number
minimum: 0
boardType:
type: string
/rr_disconnect:
get:
summary: |
Disconnect again from the RepRapFirmware controller
responses:
'200':
description: 'Disconnect response'
content:
application/json:
schema:
type: object
properties:
err:
description: 'Error code (0 = success, 1 = failed to remove session)'
minimum: 0
maximum: 1
/rr_status:
get:
deprecated: true
summary: |
Retrieve a status response from RepRapFirmware in JSON format. Deprecated in RRF 3.0 and later, use `rr_model` instead
parameters:
- name: 'type'
in: query
description: |
Type of the status response (defaults to 1)
- 1: Standard status response
- 2: Advanced status response. This also contains fields from the standard status response
- 3: Print status response. This contains fields from the standard status response as well as information about the current (print) job
required: false
schema:
type: number
minimum: 0
maximum: 3
responses:
'200':
description: |
Status response content, see [JSON responses](https://github.com/Duet3D/RepRapFirmware/blob/v3-dev/JSON%20responses.md) for further information
content:
application/json: {}
'503':
description: 'Insufficient RAM to provide the full response'
/rr_config:
get:
deprecated: true
summary: |
Retrieve the configuration response. This request provides a JSON object with values that are expected to change rarely. Deprecated in RRF 3.0 and later, use rr_model instead
responses:
'200':
description: |
Config response content, see [JSON responses](https://github.com/Duet3D/RepRapFirmware/blob/v3-dev/JSON%20responses.md) for further information
content:
application/json: {}
'503':
description: 'Insufficient RAM to provide the full response'
/rr_gcode:
get:
summary: |
Execute arbitrary G/M/T-code(s)
parameters:
- name: 'gcode'
in: query
description: 'G/M/T-code to execute. This parameter must be present although it can be empty'
required: true
schema:
type: string
responses:
'200':
description: 'Info about the G-code buffer'
content:
application/json:
schema:
type: object
properties:
bufferSpace:
description: 'How much buffer space for new G/M/T-codes is still available'
type: number
minimum: 0
/rr_reply:
get:
summary: |
Retrieve the last G-code reply.
The G-code reply is buffered per connected HTTP client and it is discarded when every HTTP client has fetched it or when the firmware is short on memory and the client has not requested it within reasonable time (1 second)
responses:
'200':
description: 'G-code reply'
content:
text/plain: {}
/rr_upload:
get:
summary: |
Get the last file upload result
responses:
'200':
description: 'Last upload result'
content:
application/json:
schema:
type: object
properties:
err:
description: 'Last file upload result (can be either `0` if the last upload successfully finished or `1` if an error occurred)'
type: number
minimum: 0
post:
summary: |
Upload a file
parameters:
- name: 'name'
in: query
description: 'Path to the file to upload'
required: true
schema:
type: string
- name: 'time'
in: query
description: 'ISO8601-like represenation of the time the file was last modified'
required: false
schema:
type: string
format: 'date-time'
- name: 'crc32'
in: query
description: 'CRC32 checksum of the file content as hex string *without* leading `0x`. Usage of this parameter is encouraged'
required: false
schema:
type: string
requestBody:
description: 'File content'
required: true
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'200':
description: 'File upload result'
content:
application/json:
schema:
type: object
properties:
err:
description: 'File upload result (can be either `0` if the last upload uccessfully finished or `1` if an error occurred [e.g. CRC mismatch])'
type: number
minimum: 0
/rr_download:
get:
summary: |
Download a file
parameters:
- name: 'name'
in: query
description: 'Path to the file to download'
required: true
schema:
type: string
responses:
'200':
description: 'Downloaded file'
content:
application/octet-stream: {}
'404':
description: 'File not found'
/rr_delete:
get:
summary: |
Delete a file or directory
parameters:
- name: 'name'
in: query
description: 'Name of the file to delete'
required: true
schema:
type: string
- name: 'recursive'
in: query
description: 'Delete directory recursively (if applicable)'
required: false
schema:
type: string
enum: ['yes', 'no']
responses:
'200':
description: 'File delete result'
content:
application/json:
schema:
type: object
properties:
err:
description: 'File delete result (either `0` on success or `1` on error)'
type: number
minimum: 0
/rr_filelist:
get:
summary: |
Retrieve a (partial) file list
parameters:
- name: 'dir'
in: query
description: 'Directory to query'
required: true
schema:
type: string
- name: 'first'
in: query
description: 'First item index to return (defaults to `0`)'
required: false
schema:
type: number
minimum: 0
- name: 'max'
in: query
description: 'Maximum number of items to return (defaults to `-1`)'
required: false
schema:
type: number
minimum: -1
responses:
'200':
description: 'File list result'
content:
application/json:
schema:
type: object
properties:
dir:
description: 'Queried directory'
type: string
first:
description: 'First item index returned'
type: number
minimum: 0
files:
type: array
items:
description: 'Files or directories'
type: object
properties:
type:
description: 'Type of this item (d = directory, f = file)'
enum:
- d
- f
name:
description: 'Filename of this item'
type: string
size:
description: 'Size of this item in bytes'
type: number
minimum: 0
date:
description: 'Last modified datetime of this item'
type: string
format: 'date-time'
next:
description: 'Index of the next item to query or 0 if there are no more items'
type: number
minimum: 0
err:
description: |
Error code
- `0`: List query successful
- `1`: Drive is not mounted
- `2`: Directory does not exist
type: number
minimum: 0
maximum: 2
'503':
description: 'Insufficient RAM to provide a response'
/rr_files:
get:
summary: |
Retrieve a list of files without any attributes
parameters:
- name: 'dir'
in: query
description: 'Directory to query'
required: true
schema:
type: string
- name: 'first'
in: query
description: 'First item index to return (defaults to `0`)'
required: false
schema:
type: number
minimum: 0
- name: 'max'
in: query
description: 'Maximum number of items to return (defaults to `-1`)'
required: false
schema:
type: number
minimum: -1
- name: 'flagDirs'
in: query
description: 'Prefix directories with a `*`'
schema:
type: number
minimum: 0
maximum: 1
responses:
'200':
description: 'File list result'
content:
application/json:
schema:
type: object
properties:
dir:
description: 'Queried directory'
type: string
first:
description: 'First item index returned'
type: number
minimum: 0
files:
type: array
items:
description: 'Files or directories'
type: string
next:
description: 'Index of the next item to query or 0 if there are no more items'
type: number
minimum: 0
err:
description: |
Error code
- `0`: List query successful
- `1`: Drive is not mounted
- `2`: Directory does not exist
type: number
minimum: 0
maximum: 2
'503':
description: 'Insufficient RAM to provide a response'
/rr_model:
get:
summary: |
Retrieve object model information like [M409](https://duet3d.dozuki.com/Wiki/Gcode#Section_M409_Query_object_model). Supported in RRF 3. and later
parameters:
- name: 'key'
in: query
description: 'Key to query'
required: true
schema:
type: string
- name: 'flags'
in: query
description: 'Query flags'
required: true
schema:
type: string
responses:
'200':
description: 'Object model result'
content:
application/json:
schema:
type: object
properties:
key:
description: 'Queried key'
type: string
flags:
description: 'Query flags'
type: string
result:
type: object
'503':
description: 'Insufficient RAM to provide a response'
/rr_move:
get:
summary: |
Move a file or directory
parameters:
- name: 'old'
in: query
description: 'Current path to the file or directory'
required: true
schema:
type: string
- name: 'new'
in: query
description: 'New path of the file or directory'
required: true
schema:
type: string
- name: 'deleteexisting'
in: query
description: 'Set this to `yes` to delete the new file if it already exists. Defaults to `no`'
required: false
schema:
type: string
enum: ['yes', 'no']
responses:
'200':
description: 'File move result'
content:
application/json:
schema:
type: object
properties:
err:
description: 'File move result (either `0` on success or `1` on error)'
type: number
minimum: 0
/rr_mkdir:
get:
summary: |
Create a new directory
parameters:
- name: 'dir'
in: query
description: 'Directory to create'
required: true
schema:
type: string
responses:
'200':
description: 'Directory create result'
content:
application/json:
schema:
type: object
properties:
err:
description: 'Directory create result (either `0` on success or `1` on error)'
type: number
minimum: 0
/rr_fileinfo:
get:
summary: |
Parse a G-code job file and return retrieved information. If no file is specified, information about the file being printed is returned
parameters:
- name: 'name'
in: query
description: 'Path to the file to parse'
required: false
schema:
type: string
responses:
'200':
description: 'File list result'
content:
application/json:
schema:
type: object
properties:
err:
description: 'Error code, either `0` on success or `1` on error'
type: number
fileName:
description: 'Filename of the G-code file'
type: string
size:
description: 'Size of the file'
type: number
lastModified:
description: 'Datetime when the file was last modified'
type: string
format: 'date-time'
height:
description: 'Object height (in mm)'
type: number
layerHeight:
description: 'Layer height (in mm)'
type: number
numLayers:
description: 'Number of layers'
type: number
printTime:
description: 'Expected time to print (in s)'
type: number
simulatedTime:
description: 'Simulated time to print (in s)'
type: number
filament:
description: 'Filament usage (in mm)'
type: array
items:
type: number
printDuration:
description: 'Current print duration (in s)'
type: number
thumbnails:
description: 'Info about embedded thumbnails'
items:
type: object
properties:
width:
description: 'Width of the thumbnail (in px)'
type: number
height:
description: 'Height of the thumbnail (in px)'
type: number
format:
description: 'Thumbnail format'
type: string
enum: ['png', 'qoi', 'jpeg']
offset:
description: 'File offset (to be used with rr_thumbnail)'
type: number
size:
description: 'Size of the thumbnail'
type: number
generatedBy:
description: 'Application that generated the file'
type: string
/rr_thumbnail:
get:
summary: |
Query a thumbnail from a G-code file
parameters:
- name: 'name'
in: query
description: 'Filename to query'
required: true
schema:
type: string
- name: 'offset'
in: query
description: 'File offset of the thumbnail'
required: true
schema:
type: number
responses:
'200':
description: 'File list result'
content:
application/json:
schema:
type: object
properties:
fileName:
description: 'Filename of the G-code file'
type: string
offset:
description: 'Offset of the thumbnail'
type: number
data:
description: 'Base64-encoded thumbnail data'
type: string
next:
description: 'Next thumbnail offset or 0 if complete'
type: number
minimum: 0
err:
description: 'Error code, either `0` on success or `1` on error'
type: number