Skip to content

Commit 596173d

Browse files
committed
Documented more endpoints
1 parent fba91b0 commit 596173d

File tree

4 files changed

+274
-58
lines changed

4 files changed

+274
-58
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ ubuntu-*-console.log
2828

2929
# Python
3030
__pycache__/
31+
/scripts/settings.py

scripts/settings.py

-1
This file was deleted.

source/includes/_queue.md

+127
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,133 @@ This endpoint adds a file to the queue. The file can either be a file on the fil
4848
| `status` | boolean | True if the request was successful. |
4949
| `message` | string | Success message or error message if `status` is false. |
5050

51+
## Get next queue item
52+
53+
```shell
54+
curl https://api.simplyprint.io/{id}/queue/GetNextItems?p=1234 \
55+
-X POST \
56+
-H 'accept: application/json' \
57+
-H 'X-API-KEY: {API_KEY}'
58+
```
59+
60+
> Request body
61+
62+
```json
63+
{
64+
"settings": {
65+
"filament": false,
66+
"filamentTemps": false,
67+
"fit": true,
68+
"gcodeAnalysis": false,
69+
"printerTemps": false
70+
}
71+
}
72+
```
73+
74+
> Success response
75+
76+
```json
77+
{
78+
"status": true,
79+
"message": null,
80+
"queue": {
81+
"total": 15,
82+
"printers": [
83+
385
84+
],
85+
"matches": [
86+
{
87+
"id": 1212,
88+
"index": 5,
89+
"printer": 385,
90+
"match": true,
91+
"issues": [
92+
"size",
93+
"temps"
94+
],
95+
"missed": 0,
96+
"name": "Benchy.gcode",
97+
"printed": 2,
98+
"left": 1
99+
}
100+
]
101+
}
102+
}
103+
```
104+
105+
> Failed response (Could not find any items that match the specified conditions)
106+
107+
```json
108+
{
109+
"status": true,
110+
"message": null,
111+
"queue": {
112+
"total": 15,
113+
"printers": [
114+
385
115+
],
116+
"matches": [
117+
{
118+
"printer": 385,
119+
"match": false,
120+
"issues": [
121+
"size",
122+
"temps"
123+
],
124+
"missed": 4
125+
}
126+
]
127+
}
128+
}
129+
```
130+
131+
<aside class="notice">
132+
This endpoint requires the <b>Print Farm</b> plan.
133+
</aside>
134+
135+
This endpoint gets the next item in the queue for the specified printer. The next item is the item that has the highest priority. The result will have skipped all items that do not meet the specified conditions.
136+
137+
### Request
138+
139+
`POST /{id}/queue/GetNextItems`
140+
141+
#### Request parameters
142+
143+
| Parameter | Type | Required | Description |
144+
| --------- | ---- | -------- | ----------- |
145+
| p | integer[] | yes | Comma separated list of printer ids to get the next items for. |
146+
147+
#### Request body
148+
149+
| Parameter | Type | Required | Description |
150+
| --------- | ---- | -------- | ----------- |
151+
| `settings` | object | no | Conditions that must be met for the next item. |
152+
| `settings.filament` | boolean | no | Must have enough filament.<br>**Default: true** |
153+
| `settings.filamentTemps` | boolean | no | Printer's filament temperature must match filament temperature of file.<br>**Default: true** |
154+
| `settings.fit` | boolean | no | Print must fit printer's bed.<br>**Default: true** |
155+
| `settings.gcodeAnalysis` | boolean | no | Must have gcode analysis.<br>**Default: true** |
156+
| `settings.printerTemps` | boolean | no | File must have a max temperature that is lower than the printer's max temperature.<br>**Default: true** |
157+
158+
### Response
159+
160+
| Parameter | Type | Description |
161+
| --------- | ---- | ----------- |
162+
| `status` | boolean | True if the request was successful. |
163+
| `message` | string | Success message or error message if `status` is false. |
164+
| `queue` | object | The queue object. |
165+
| `queue.total` | integer | The total amount of items in the queue. |
166+
| `queue.printers` | integer[] | The printer ids that were requested. |
167+
| `queue.matches` | array | The next items for each printer. |
168+
| `queue.matches[].id` | integer | The id of the next item. Only present if `match` is true. |
169+
| `queue.matches[].index` | integer | The index of the item in the queue. Only present if `match` is true. |
170+
| `queue.matches[].printer` | integer | The id of the printer that the item is for. |
171+
| `queue.matches[].match` | boolean | True if a match was found. |
172+
| `queue.matches[].issues` | string[] | The issues that are present in the item. Can also have values if an item was matched but would have been catched by other settings. |
173+
| `queue.matches[].missed` | integer | The amount of items that were skipped. |
174+
| `queue.matches[].name` | string | The name of the item. Only present if `match` is true. |
175+
| `queue.matches[].printed` | integer | The amount of completed prints of this item (from print queue). Only present if `match` is true. |
176+
| `queue.matches[].left` | integer | The amount of prints left (from print queue). Only present if `match` is true. |
177+
51178
## Get queue items
52179

53180
```shell

0 commit comments

Comments
 (0)