Skip to content

Commit aaddd24

Browse files
committed
add missing endpoints, edit responses
1 parent d87ada3 commit aaddd24

16 files changed

+1045
-292
lines changed

source/includes/_account.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ This endpoint updates the groups in the company.
167167

168168
```shell
169169
curl https://api.simplyprint.io/{id}/account/GetGroups \
170-
-X GET \
171170
-H 'accept: application/json' \
172171
-H 'X-API-KEY: {API_KEY}'
173172
```

source/includes/_api_files.md

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# API Files
22

3-
The base URL for the SimplyPrint Files API is `https://files.simplyprint.io/{id}/`. Use the exact same authentication as the normal api endpoint. It is very important you ensure you send files with the correct file extension. The API will not be able to determine the file type based on the content.
3+
The base URL for the SimplyPrint Files API is `https://files.simplyprint.io/{id}/`. Use the exact same authentication as
4+
the normal api endpoint. It is very important you ensure you send files with the correct file extension. The API will
5+
not be able to determine the file type based on the content.
46

57
## Upload a file using the API
68

79
<aside class="notice">
810
This endpoint requires the <b>Print Farm</b> plan.
911
</aside>
1012

11-
`POST {id}/files/Upload`
13+
`POST /{id}/files/Upload`
1214

1315
> Example request to upload a file less than 100MB
1416
@@ -18,17 +20,18 @@ curl -X POST "https://files.simplyprint.io/{id}/files/Upload" \
1820
-H "X-API-KEY: {API_KEY}" \
1921
-F "file=@/path/to/file.gcode"
2022
```
23+
2124
> Success response
2225
2326
```json
2427
{
25-
"status":true,
26-
"message": null,
27-
"file": {
28-
"id": "f568ead4bbc2d881efc8a9a05f3bd585334cd8c662347ba2dfad7250176b0abd",
29-
"name": "file.gcode",
30-
"size": 13439
31-
}
28+
"status": true,
29+
"message": null,
30+
"file": {
31+
"id": "f568ead4bbc2d881efc8a9a05f3bd585334cd8c662347ba2dfad7250176b0abd",
32+
"name": "file.gcode",
33+
"size": 13439
34+
}
3235
}
3336
```
3437

@@ -41,13 +44,14 @@ curl -X POST "https://files.simplyprint.io/{id}/files/Upload" \
4144
-F "file=@/path/to/part1.3mf"
4245
-F "totalSize=3352316"
4346
```
47+
4448
> Success response with continueToken
4549
4650
```json
4751
{
48-
"status":true,
49-
"message":null,
50-
"continueToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzM4NCJ9.eyJ0eXBlIjoiYWN0ao9uX3Rva2VuIiwiYWN0aW9uIjoiZmlsZV9jb250aW51ZV91cGxvYWQiLCJ1c2VyIjo2OTc2LCJjb21wYW55IjoyLCJkYXRhIja7ImJ1Y2tldEhhc2giOiI0MGQ2MzgwNmQwYWUxODhkNjc5YzY0NjA0M2RiYjUxMTc0NTViNTc1NjNlODEzZDc2MGRjMTJkMzVaYjdmY2Y0IiwidG90YWxTaXplIjoxNjc2MTU4NH0sImlhdCI6MTcyNTU2MjEzMywiZXhwIjoxNzI1NjQ4NTMzfQ.9qyNyx9A4Ox_6GrFSxXpxlpLcAKaSr8ln84X3yuWdhT_2O3L8-lGWaXAbQk9VvR-3pu1-a9p40amnt6Fghy49InjzCfNMRp-6-Ft_uMRf6PbmcCCrksvRxNP38ImoXy6"
52+
"status": true,
53+
"message": null,
54+
"continueToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzM4NCJ9.eyJ0eXBlIjoiYWN0ao9uX3Rva2VuIiwiYWN0aW9uIjoiZmlsZV9jb250aW51ZV91cGxvYWQiLCJ1c2VyIjo2OTc2LCJjb21wYW55IjoyLCJkYXRhIja7ImJ1Y2tldEhhc2giOiI0MGQ2MzgwNmQwYWUxODhkNjc5YzY0NjA0M2RiYjUxMTc0NTViNTc1NjNlODEzZDc2MGRjMTJkMzVaYjdmY2Y0IiwidG90YWxTaXplIjoxNjc2MTU4NH0sImlhdCI6MTcyNTU2MjEzMywiZXhwIjoxNzI1NjQ4NTMzfQ.9qyNyx9A4Ox_6GrFSxXpxlpLcAKaSr8ln84X3yuWdhT_2O3L8-lGWaXAbQk9VvR-3pu1-a9p40amnt6Fghy49InjzCfNMRp-6-Ft_uMRf6PbmcCCrksvRxNP38ImoXy6"
5155
}
5256
```
5357

@@ -65,33 +69,33 @@ curl -X POST "https://files.simplyprint.io/{id}/files/Upload" \
6569
6670
```json
6771
{
68-
"status":true,
69-
"message":null,
70-
"file": {
71-
"id": "f568ead4bbc2d881efc8a9a05f3bd585334cd8c662347ba2dfad7250176b0abd",
72-
"name": "part1.3mf",
73-
"size": 3352316
74-
}
72+
"status": true,
73+
"message": null,
74+
"file": {
75+
"id": "f568ead4bbc2d881efc8a9a05f3bd585334cd8c662347ba2dfad7250176b0abd",
76+
"name": "part1.3mf",
77+
"size": 3352316
78+
}
7579
}
7680
```
7781

7882
### Request
7983

80-
| Parameter | Type | Required | Description |
81-
| --------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82-
| `file` | file | yes | Uploaded file (Max 100mb) |
83-
| `continueToken` | string | no | Optional token you'll get if you need to continue the upload for files greater than 100MB. |
84-
| `totalSize` | integer | no | Send this if you want a continueToken, by providing the total size of the entire file you want to upload |
84+
| Parameter | Type | Required | Description |
85+
|-----------------|---------|----------|----------------------------------------------------------------------------------------------------------|
86+
| `file` | file | yes | Uploaded file (Max 100mb) |
87+
| `continueToken` | string | no | Optional token you'll get if you need to continue the upload for files greater than 100MB. |
88+
| `totalSize` | integer | no | Send this if you want a continueToken, by providing the total size of the entire file you want to upload |
8589

8690
### Response
8791

88-
| Parameter | Type | Description |
89-
| ------------ | ------- | -------------------------------------------------------------|
90-
| `status` | boolean | True if the request was successful. |
91-
| `message` | string | Error message if `status` is false. |
92-
| `continueToken` | string | For every subsequent request that still has some pending size based on the total size this will be returned instead of the file. |
93-
| `file.*` | object | Final file object after entire file has been uploaded |
94-
| `file.id` | string | The API File ID you'll need to use other SimplyPrint APIs |
95-
| `file.name` | string | Name used to reference the file |
96-
| `file.size` | int | Total size of uploaded file |
92+
| Parameter | Type | Description |
93+
|-----------------|---------|----------------------------------------------------------------------------------------------------------------------------------|
94+
| `status` | boolean | True if the request was successful. |
95+
| `message` | string | Error message if `status` is false. |
96+
| `continueToken` | string | For every subsequent request that still has some pending size based on the total size this will be returned instead of the file. |
97+
| `file.*` | object | Final file object after entire file has been uploaded |
98+
| `file.id` | string | The API File ID you'll need to use other SimplyPrint APIs |
99+
| `file.name` | string | Name used to reference the file |
100+
| `file.size` | int | Total size of uploaded file |
97101

source/includes/_custom_fields.md

Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
# Custom Fields
2+
3+
<aside class="notice">
4+
This feature requires the <b>Print Farm</b> plan.
5+
</aside>
6+
7+
Custom Fields allow you to add your own data-fields inside SimplyPrint.
8+
9+
[Read more about Custom Fields on our Helpdesk](https://help.simplyprint.io/en/article/all-about-the-custom-fields-feature-4dd5if/)
10+
11+
## List custom fields
12+
13+
`POST /{id}/custom_fields/Get`
14+
15+
> Example request
16+
17+
```shell
18+
curl -X POST https://api.simplyprint.io/{id}/custom_fields/Get \
19+
-H 'accept: application/json' \
20+
-H "X-API-KEY: {API_KEY}" \
21+
-F "page=1" -F "page_size=10"
22+
```
23+
24+
> Example response
25+
26+
```json
27+
{
28+
"status": true,
29+
"message": null,
30+
"data": [
31+
{
32+
"id": 7,
33+
"fieldId": "student_id",
34+
"fieldLabel": "Student ID",
35+
"fieldDescription": "",
36+
"fieldPlaceholder": null,
37+
"fieldType": "text",
38+
"fieldOptions": null,
39+
"category": "print",
40+
"subCategory": [
41+
"user_file",
42+
"print_queue",
43+
"print_job"
44+
],
45+
"required": false,
46+
"enabled": true,
47+
"defaultValue": null,
48+
"visibleRequiredPermissions": null,
49+
"editRequiredPermissions": null,
50+
"visibleToGroups": [],
51+
"editableByGroups": [],
52+
"validation": null,
53+
"createdByUser": -1,
54+
"user": "John Doe",
55+
"forPrinters": [],
56+
"forModels": [],
57+
"forGroups": [],
58+
"showOnRegistration": null,
59+
"showBeforeStartPrint": null,
60+
"position": 0,
61+
"created": "2024-09-07T13:46:59+00:00",
62+
"updated": "2024-09-07T13:46:59+00:00"
63+
}
64+
],
65+
"page_amount": 1,
66+
"total": 1
67+
}
68+
```
69+
70+
### Request
71+
72+
| Parameter | Type | Required | Description |
73+
|-------------|---------|----------|-----------------------------------------------------------------------------------------------------------------|
74+
| `page` | integer | yes | Which page to show |
75+
| `page_size` | integer | yes | Amount of items per page (1-100) |
76+
| `search` | string | no | The search filter to apply |
77+
| `sort_id` | string | no | What key to sort on (id, fieldId, fieldLabel, fieldDescription, fieldType, category, enabled, created, updated) |
78+
| `sort_dir` | string | no | Sort direction (`asc`, `desc`) |
79+
80+
### Response
81+
82+
| Parameter | Type | Description |
83+
|-----------|---------|-------------------------------------|
84+
| `status` | boolean | True if the request was successful. |
85+
| `message` | string | Error message if `status` is false. |
86+
| `data` | array | List of custom fields. |
87+
88+
## Create or update a custom field
89+
90+
`POST /{id}/custom_fields/Save`
91+
92+
> Example request
93+
94+
```shell
95+
curl -X POST https://api.simplyprint.io/{id}/custom_fields/Save \
96+
-H 'accept: application/json' \
97+
-H 'Content-Type: application/json' \
98+
-H 'X-API-KEY: {API_KEY}' \
99+
-d '{"category":"print","subCategory":["user_file","print_queue","print_job"],"fieldType":"text","fieldId":"student_id","fieldLabel":"Student ID","required":false,"enabled":true}'
100+
```
101+
102+
> Example response
103+
104+
```json
105+
{
106+
"status": true,
107+
"message": null
108+
}
109+
```
110+
111+
### Request
112+
113+
| Parameter | Type | Required | Description |
114+
|------------------------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
115+
| `id` | integer | no | If you want to update an existing custom field, specify this |
116+
| `category` | string | yes | One of `print`, `user`, `printer`, `filament` |
117+
| `subCategory` | array | no | Array of subcategories. Valid subcategories: `print_queue`, `print_job`, `user_file` |
118+
| `fieldId` | string | yes | ID of the field |
119+
| `fieldType` | string | yes | One of `boolean`, `text`, `longtext`, `number`, `date`, `datetime`, `phone`, `email`, `url`, `select`, `multiselect`, `radio`, `checkbox` |
120+
| `fieldLabel` | string | yes | Label of the field |
121+
| `fieldOptions` | object | no | Field options. An object with one entry, `options`, whose value is an array of `{label: string, value: string}` |
122+
| `FieldDescription` | string | no | Description of the field |
123+
| `fieldPlaceholder` | string | no | Placeholder text for the field |
124+
| `required` | boolean | yes | Whether the field is required |
125+
| `defaultValue` | object | no | Default value of the field. Object key should be either `string`, `number`, `boolean`, `date`, `options`, with the appropriate value type |
126+
| `validation` | object | no | Validation rules for the field. Object keys can be any of `stringRegex`, `stringMinLength`, `stringMaxLength`, `numberAllowDecimals`, `numberMinValue`, `numberMaxValue`, `validationMessage` |
127+
| `forPrinters` | array | no | Array of printer IDs the field should be visible for |
128+
| `forModels` | array | no | Array of model IDs the field should be visible for |
129+
| `forGroups` | array | no | Array of group IDs the field should be visible for |
130+
| `showOnRegistration` | boolean | no | Whether the field should be shown on registration |
131+
| `showBeforeStartPrint` | boolean | no | Whether the field should be shown before starting a print |
132+
133+
### Response
134+
135+
| Parameter | Type | Description |
136+
|-----------|---------|-------------------------------------|
137+
| `status` | boolean | True if the request was successful. |
138+
| `message` | string | Error message if `status` is false. |
139+
140+
## Enable or disable a custom field
141+
142+
`POST /{id}/custom_fields/SetEnabled`
143+
144+
> Example request
145+
146+
```shell
147+
curl -X POST https://api.simplyprint.io/{id}/custom_fields/SetEnabled \
148+
-H 'accept: application/json' \
149+
-H 'Content-Type: application/json' \
150+
-H 'X-API-KEY: {API_KEY}' \
151+
-d '{"id": 123, "enabled": true}'
152+
```
153+
154+
> Example response
155+
156+
```json
157+
{
158+
"status": true,
159+
"message": null
160+
}
161+
```
162+
163+
### Request
164+
165+
| Parameter | Type | Required | Description |
166+
|-----------|---------|----------|---------------------------------------------------------------------------|
167+
| `id` | integer | yes | ID of the custom field to enable or disable |
168+
| `enabled` | boolean | yes | Whether the custom field should be enabled (`true`) or disabled (`false`) |
169+
170+
### Response
171+
172+
| Parameter | Type | Description |
173+
|-----------|---------|-------------------------------------|
174+
| `status` | boolean | True if the request was successful. |
175+
| `message` | string | Error message if `status` is false. |
176+
177+
## Delete custom fields
178+
179+
`GET /{id}/custom_fields/Delete`
180+
181+
> Example request
182+
183+
```shell
184+
curl https://api.simplyprint.io/{id}/custom_fields/Delete?id=123 \
185+
-H 'accept: application/json' \
186+
-H 'X-API-KEY: {API_KEY}'
187+
```
188+
189+
> Example request with multiple IDs
190+
191+
```shell
192+
curl https://api.simplyprint.io/{id}custom_fields/Delete?ids=123,124,125 \
193+
-H 'accept: application/json' \
194+
-H 'X-API-KEY: {API_KEY}'
195+
```
196+
197+
> Example response
198+
199+
```json
200+
{
201+
"status": true,
202+
"message": null
203+
}
204+
```
205+
206+
### Request
207+
208+
| Parameter | Type | Required | Description |
209+
|-----------|---------|--------------------------------|----------------------------------------------------------------------------------------------------|
210+
| `id` | integer | yes (if `ids` is not provided) | The ID of the custom field to delete. |
211+
| `ids` | string | yes (if `id` is not provided) | A comma-separated list of custom field IDs to delete. Valid if multiple fields need to be removed. |
212+
213+
### Response
214+
215+
| Parameter | Type | Description |
216+
|-----------|---------|-------------------------------------|
217+
| `status` | boolean | True if the request was successful. |
218+
| `message` | string | Error message if `status` is false. |
219+
220+
## Custom field submission value
221+
222+
The value of a custom field when submitted via the API is an object with a key corresponding to the field type.
223+
See the examples to the right for the different field types.
224+
225+
> A text field would have a value like this:
226+
227+
```json
228+
{
229+
"string": "1234567890"
230+
}
231+
```
232+
233+
> A number field would have a value like this:
234+
235+
```json
236+
{
237+
"number": 1234567890
238+
}
239+
```
240+
241+
> A date field would have a value like this:
242+
243+
```json
244+
{
245+
"date": "2024-09-07"
246+
}
247+
```
248+
249+
> A select field would have a value like this:
250+
251+
```json
252+
{
253+
"string": "Selected option"
254+
}
255+
```
256+
257+
> A multi-select field would have a value like this:
258+
259+
```json
260+
{
261+
"options": ["Option 1", "Option 2"]
262+
}
263+
```

0 commit comments

Comments
 (0)