Skip to content

Commit 991e393

Browse files
committed
Almost done with Queue
1 parent 2d6ff1c commit 991e393

File tree

1 file changed

+261
-34
lines changed

1 file changed

+261
-34
lines changed

source/includes/_queue.md

Lines changed: 261 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,67 @@
11
# Queue
22

3-
## AddItem
3+
## Add item to queue
44

55
```shell
66
curl https://api.simplyprint.io/{id}/queue/AddItem \
7-
-X ? \
7+
-X POST \
88
-H 'accept: application/json' \
99
-H 'X-API-KEY: {API_KEY}'
1010
```
1111

12+
> Request body
13+
14+
```json
15+
{
16+
"filesystem": "1a077dd6296417fe75555bf806b68089"
17+
}
18+
```
19+
1220
> Success response
1321
1422
```json
1523
{
16-
"TODO": "TODO"
24+
"status": true,
25+
"message": null
1726
}
1827
```
1928

29+
<aside class="notice">
30+
This endpoint requires the <b>Print Farm</b> plan.
31+
</aside>
32+
33+
This endpoint adds a file to the queue. The file can either be a file on the filesystem or an uploaded stl/3mf/obj/gcode/gco/nc/npg file.
34+
2035
### Request
2136

22-
`? /{id}/queue/AddItem`
37+
`POST /{id}/queue/AddItem`
38+
39+
You must specify either a filesystem id or a file to upload.
40+
41+
#### Parameters
42+
43+
| Parameter | Type | Required | Description |
44+
| --------- | ---- | -------- | ----------- |
45+
| `filesystem` | string | no | The filesystem id of the file to add to the queue. |
46+
| `amount` | int | no | The amount of prints to add to the queue.<br>**Default: 1** |
2347

24-
TODO
48+
#### File upload
2549

26-
## GetItems
50+
| File | Type | Required | Description |
51+
| --------- | ---- | -------- | ----------- |
52+
| `file` | stl/3mf/obj/gcode/gco/nc/npg | no | The file to add to the queue.<br>**Max file size: 100MB (bigger files must be uploaded to the filesystem first)** |
53+
54+
### Response
55+
56+
| Parameter | Type | Description |
57+
| --------- | ---- | ----------- |
58+
| `status` | boolean | True if the request was successful. |
59+
| `message` | string | Success message or error message if `status` is false. |
60+
61+
## Get queue items
2762

2863
```shell
29-
curl https://api.simplyprint.io/{id}/queue/GetItems \
30-
-X ? \
64+
curl https://api.simplyprint.io/{id}/queue/GetItems?p=1234 \
3165
-H 'accept: application/json' \
3266
-H 'X-API-KEY: {API_KEY}'
3367
```
@@ -36,44 +70,189 @@ curl https://api.simplyprint.io/{id}/queue/GetItems \
3670
3771
```json
3872
{
39-
"TODO": "TODO"
73+
"status": true,
74+
"message": null,
75+
"queue": {
76+
"fits": true,
77+
"items": [
78+
{
79+
"id": 51293,
80+
"index": 1,
81+
"filename": "benchy.gcode",
82+
"model": false,
83+
"left": 1,
84+
"printed": 0,
85+
"for": {
86+
"printers": [
87+
1234
88+
],
89+
"models": [
90+
1234
91+
],
92+
"groups": [
93+
1234
94+
]
95+
},
96+
"analysis": {
97+
"slicer": "Simplify3D",
98+
"filament": [
99+
60
100+
],
101+
"estimate": 240,
102+
"movement": {
103+
"mRelative": 0,
104+
"eRelative": 0
105+
},
106+
"temps": {
107+
"tool": {
108+
"T0": 210
109+
},
110+
"bed": 50,
111+
"pset": 1
112+
},
113+
"modelSize": {
114+
"x": 151,
115+
"y": 16,
116+
"z": 5
117+
},
118+
"printArea": {
119+
"maxX": 156.05,
120+
"minX": 5,
121+
"maxY": 157.86,
122+
"minY": 142.14,
123+
"maxZ": 5,
124+
"minZ": 0.2
125+
},
126+
"minDeltaRadius": 313.91,
127+
"v": 5
128+
},
129+
"user": "John Doe",
130+
"user_id": 1234
131+
}
132+
]
133+
}
40134
}
41135
```
42136

43-
### Request
137+
<aside class="notice">
138+
This endpoint requires the <b>Print Farm</b> plan.
139+
</aside>
44140

45-
`? /{id}/queue/GetItems`
141+
This endpoint returns the queue for the specified or all printers.
46142

47-
TODO
143+
### Request
48144

49-
## UpdateItem
145+
`GET /{id}/queue/GetItems`
146+
147+
| Parameter | Type | Required | Description |
148+
| --------- | ---- | -------- | ----------- |
149+
| `p` | int | no | The printer id to get the queue for. If not specified, the queue for all printers will be returned. |
150+
151+
### Response
152+
153+
| Parameter | Type | Description |
154+
| --------- | ---- | ----------- |
155+
| `status` | boolean | True if the request was successful. |
156+
| `message` | string | Success message or error message if `status` is false. |
157+
| `queue` | object | The queue object. |
158+
| `queue.fits` | boolean | TODO |
159+
| `queue.items` | array | An array of queue item objects. |
160+
| `queue.items[].id` | int | The queue item id. |
161+
| `queue.items[].index` | int | The queue item index. |
162+
| `queue.items[].filename` | string | The queue item filename. |
163+
| `queue.items[].model` | boolean | True if the queue item is a model. |
164+
| `queue.items[].left` | int | The amount of prints left to print. |
165+
| `queue.items[].printed` | int | The amount of prints that have been printed. |
166+
| `queue.items[].for` | object | For which printers, models and groups this queue item is for. |
167+
| `queue.items[].for.printers` | array | An array of printer ids. |
168+
| `queue.items[].for.models` | array | An array of printer model ids. |
169+
| `queue.items[].for.groups` | array | An array of group ids. |
170+
| `queue.items[].analysis` | object | The analysis object. |
171+
| `queue.items[].analysis.slicer` | string | The slicer used to slice the file. |
172+
| `queue.items[].analysis.filament` | array | An array of filament lengths. |
173+
| `queue.items[].analysis.estimate` | int | The estimated print time in seconds. |
174+
| `queue.items[].analysis.movement` | object | The movement object. |
175+
| `queue.items[].analysis.temps` | object | The temperatures object. |
176+
| `queue.items[].analysis.temps.tool` | object | Temperature for each tool (extruder). |
177+
| `queue.items[].analysis.temps.bed` | int | Temperature for the bed. |
178+
| `queue.items[].analysis.temps.pset` | int | TODO |
179+
| `queue.items[].analysis.modelSize` | object | The model size object. Represented as `x`, `y` and `z` values in millimeters. |
180+
| `queue.items[].analysis.printArea` | object | The print area object. Represented as `maxX`, `minX`, `maxY`, `minY`, `maxZ` and `minZ` values in millimeters. |
181+
| `queue.items[].analysis.minDeltaRadius` | float | Minimum radius for delta printers. |
182+
| `queue.items[].analysis.v` | int | The analysis version. |
183+
| `queue.items[].user` | string | The user name of who added the queue item. |
184+
| `queue.items[].user_id` | int | The user id of who added the queue item. |
185+
186+
## Update queue item
50187

51188
```shell
52-
curl https://api.simplyprint.io/{id}/queue/UpdateItem \
53-
-X ? \
189+
curl https://api.simplyprint.io/{id}/queue/UpdateItem?job=1234 \
190+
-X POST \
54191
-H 'accept: application/json' \
55192
-H 'X-API-KEY: {API_KEY}'
56193
```
57194

195+
> Request body
196+
197+
```json
198+
{
199+
"for_groups": [
200+
1234
201+
],
202+
"for_models": [
203+
1234
204+
],
205+
"for_printers": [
206+
1234
207+
]
208+
}
209+
```
210+
58211
> Success response
59212
60213
```json
61214
{
62-
"TODO": "TODO"
215+
"status": true,
216+
"message": null
63217
}
64218
```
65219

220+
<aside class="notice">
221+
This endpoint requires the <b>Print Farm</b> plan.
222+
</aside>
223+
224+
This endpoint updates the queue item with the specified id.
225+
66226
### Request
67227

68-
`? /{id}/queue/UpdateItem`
228+
`POST /{id}/queue/UpdateItem`
229+
230+
#### Query parameters
231+
232+
| Parameter | Type | Required | Description |
233+
| --------- | ---- | -------- | ----------- |
234+
| `job` | int | yes | The queue item id to update. |
69235

70-
TODO
236+
#### Request body
71237

72-
## DeleteItem
238+
| Parameter | Type | Required | Description |
239+
| --------- | ---- | -------- | ----------- |
240+
| `for_groups` | array | no | An array of group ids to assign the queue item to. |
241+
| `for_models` | array | no | An array of printer model ids to assign the queue item to. |
242+
| `for_printers` | array | no | An array of printer ids to assign the queue item to. |
243+
| `amount` | int | no | The new amount to set. |
244+
245+
### Response
246+
247+
| Parameter | Type | Description |
248+
| --------- | ---- | ----------- |
249+
| `status` | boolean | True if the request was successful. |
250+
| `message` | string | Success message or error message if `status` is false. |
251+
252+
## Delete queue item
73253

74254
```shell
75-
curl https://api.simplyprint.io/{id}/queue/DeleteItem \
76-
-X ? \
255+
curl https://api.simplyprint.io/{id}/queue/DeleteItem?job=1234 \
77256
-H 'accept: application/json' \
78257
-H 'X-API-KEY: {API_KEY}'
79258
```
@@ -82,21 +261,36 @@ curl https://api.simplyprint.io/{id}/queue/DeleteItem \
82261
83262
```json
84263
{
85-
"TODO": "TODO"
264+
"status": true,
265+
"message": null
86266
}
87267
```
88268

269+
<aside class="notice">
270+
This endpoint requires the <b>Print Farm</b> plan.
271+
</aside>
272+
273+
This endpoint deletes the queue item with the specified id.
274+
89275
### Request
90276

91277
`? /{id}/queue/DeleteItem`
92278

93-
TODO
279+
| Parameter | Type | Required | Description |
280+
| --------- | ---- | -------- | ----------- |
281+
| `job` | int | yes | The queue item id to delete. |
94282

95-
## SetOrder
283+
### Response
284+
285+
| Parameter | Type | Description |
286+
| --------- | ---- | ----------- |
287+
| `status` | boolean | True if the request was successful. |
288+
| `message` | string | Success message or error message if `status` is false. |
289+
290+
## Change queue order
96291

97292
```shell
98-
curl https://api.simplyprint.io/{id}/queue/SetOrder \
99-
-X ? \
293+
curl https://api.simplyprint.io/{id}/queue/SetOrder?job=1234&from=0&to=1 \
100294
-H 'accept: application/json' \
101295
-H 'X-API-KEY: {API_KEY}'
102296
```
@@ -105,21 +299,38 @@ curl https://api.simplyprint.io/{id}/queue/SetOrder \
105299
106300
```json
107301
{
108-
"TODO": "TODO"
302+
"success": true,
303+
"message": null
109304
}
110305
```
111306

307+
<aside class="notice">
308+
This endpoint requires the <b>Print Farm</b> plan.
309+
</aside>
310+
311+
This endpoint changes the order of the queue items by moving the queue item with the specified id.
312+
112313
### Request
113314

114-
`? /{id}/queue/SetOrder`
315+
`GET /{id}/queue/SetOrder`
316+
317+
| Parameter | Type | Required | Description |
318+
| --------- | ---- | -------- | ----------- |
319+
| `job` | int | yes | The queue item id to move. |
320+
| `from` | int | yes | The current position of the queue item. |
321+
| `to` | int | yes | The new position of the queue item. |
115322

116-
TODO
323+
### Response
117324

118-
## EmptyQueue
325+
| Parameter | Type | Description |
326+
| --------- | ---- | ----------- |
327+
| `success` | boolean | True if the request was successful. |
328+
| `message` | string | Success message or error message if `success` is false. |
329+
330+
## Empty queue
119331

120332
```shell
121333
curl https://api.simplyprint.io/{id}/queue/EmptyQueue \
122-
-X ? \
123334
-H 'accept: application/json' \
124335
-H 'X-API-KEY: {API_KEY}'
125336
```
@@ -128,12 +339,28 @@ curl https://api.simplyprint.io/{id}/queue/EmptyQueue \
128339
129340
```json
130341
{
131-
"TODO": "TODO"
342+
"status": true,
343+
"message": null
132344
}
133345
```
134346

347+
<aside class="notice">
348+
This endpoint requires the <b>Print Farm</b> plan.
349+
</aside>
350+
351+
| Required Permissions |
352+
| -------------------- |
353+
| `PRINT_QUEUE_REMOVE_ALL` |
354+
355+
This endpoint empties the queue.
356+
135357
### Request
136358

137-
`? /{id}/queue/EmptyQueue`
359+
`GET /{id}/queue/EmptyQueue`
360+
361+
### Response
138362

139-
TODO
363+
| Parameter | Type | Description |
364+
| --------- | ---- | ----------- |
365+
| `status` | boolean | True if the request was successful. |
366+
| `message` | string | Success message or error message if `status` is false. |

0 commit comments

Comments
 (0)