Skip to content

Commit bdf8c15

Browse files
committed
Improve API docs
1 parent 6ce57f1 commit bdf8c15

13 files changed

+616
-517
lines changed

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/includes/_account.md

Lines changed: 114 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
curl https://api.simplyprint.io/{id}/account/settings/groups/Create \
77
-X POST \
88
-H 'accept: application/json' \
9-
-H 'X-API-KEY: {API_KEY}'
9+
-H 'Content-Type: application/json' \
10+
-H 'X-API-KEY: {API_KEY}' \
11+
-d '{
12+
"ranks": [
13+
{
14+
"title": "name of group",
15+
"description": "group description",
16+
"sort_order": 3,
17+
"permissions": {
18+
"view_news": true,
19+
"org_admin": true
20+
}
21+
}
22+
]
23+
}'
1024
```
1125

12-
> Request body
13-
14-
```json
15-
{
16-
"ranks": [
17-
{
18-
"title": "name of group",
19-
"description": "group description",
20-
"sort_order": 3,
21-
"permissions": "{\"view_news\":true,\"org_admin\":true,\"panel_printing\":true,\"printer_restart\":true,\"printer_edit\":true,\"bed_leveling\":true,\"gcode_profiles\":true,\"printer_settings\":true,\"filament_settings\":true,\"change_filament\":true,\"create_filament\":true,\"see_filament_tab\":true,\"view_users\":true,\"change_user_rank\":true,\"manual_user_email_confirm\":true,\"invite_users\":true,\"delete_user\":true,\"org_user_registration_settings\":true,\"org_hub_settings\":true,\"org_rank_management\":true,\"org_view_statistics\":true,\"refill_quota\":true,\"custom_slicer_profiles\":true,\"org_profiles\":true,\"all_slicer_modes\":true,\"queue_remove_all\":true,\"org_api\":true,\"create_org_folder\":true,\"cancel_others\":true,\"see_who_printed\":true,\"max_print_size\":[],\"default_slicer_mode\":2}"
22-
}
23-
]
24-
}
25-
```
2626

2727
> Success response
2828
@@ -37,7 +37,40 @@ curl https://api.simplyprint.io/{id}/account/settings/groups/Create \
3737
"company_id": 2,
3838
"company_type": 2,
3939
"sort_order": 3,
40-
"permissions": "{\"view_news\":true,\"org_admin\":true,\"panel_printing\":true,\"printer_restart\":true,\"printer_edit\":true,\"bed_leveling\":true,\"gcode_profiles\":true,\"printer_settings\":true,\"filament_settings\":true,\"change_filament\":true,\"create_filament\":true,\"see_filament_tab\":true,\"view_users\":true,\"change_user_rank\":true,\"manual_user_email_confirm\":true,\"invite_users\":true,\"delete_user\":true,\"org_user_registration_settings\":true,\"org_hub_settings\":true,\"org_rank_management\":true,\"org_view_statistics\":true,\"refill_quota\":true,\"custom_slicer_profiles\":true,\"org_profiles\":true,\"all_slicer_modes\":true,\"queue_remove_all\":true,\"org_api\":true,\"create_org_folder\":true,\"cancel_others\":true,\"see_who_printed\":true,\"max_print_size\":[],\"default_slicer_mode\":2}",
40+
"permissions": {
41+
"view_news": true,
42+
"org_admin": true,
43+
"panel_printing": true,
44+
"printer_restart": true,
45+
"printer_edit": true,
46+
"bed_leveling": true,
47+
"gcode_profiles": true,
48+
"printer_settings": true,
49+
"filament_settings": true,
50+
"change_filament": true,
51+
"create_filament": true,
52+
"see_filament_tab": true,
53+
"view_users": true,
54+
"change_user_rank": true,
55+
"manual_user_email_confirm": true,
56+
"invite_users": true,
57+
"delete_user": true,
58+
"org_user_registration_settings": true,
59+
"org_hub_settings": true,
60+
"org_rank_management": true,
61+
"org_view_statistics": true,
62+
"refill_quota": true,
63+
"custom_slicer_profiles": true,
64+
"org_profiles": true,
65+
"all_slicer_modes": true,
66+
"queue_remove_all": true,
67+
"org_api": true,
68+
"create_org_folder": true,
69+
"cancel_others": true,
70+
"see_who_printed": true,
71+
"max_print_size": [],
72+
"default_slicer_mode": 2
73+
},
4174
"id": 319
4275
}
4376
]
@@ -68,7 +101,7 @@ This endpoint creates a new group in the company.
68101
| `ranks[].title` | string | yes | The name of the group. |
69102
| `ranks[].description` | string | no | The description of the group. |
70103
| `ranks[].sort_order` | integer | yes | The sort index of the group. |
71-
| `ranks[].permissions` | string | yes | JSON string of the permissions of the group. For more information, see [Permissions](#permissions). |
104+
| `ranks[].permissions` | object | yes | Object containing permissions for the group. Use permission strings from the [Permissions](#permissions) table as keys with boolean values. |
72105

73106
### Response
74107

@@ -84,24 +117,24 @@ This endpoint creates a new group in the company.
84117
curl https://api.simplyprint.io/{id}/account/settings/groups/Update \
85118
-X POST \
86119
-H 'accept: application/json' \
87-
-H 'X-API-KEY: {API_KEY}'
120+
-H 'Content-Type: application/json' \
121+
-H 'X-API-KEY: {API_KEY}' \
122+
-d '{
123+
"ranks": [
124+
{
125+
"id": 319,
126+
"title": "TITLE",
127+
"description": "DESCRIPTION",
128+
"permissions": {
129+
"view_news": true,
130+
"org_admin": true
131+
},
132+
"sort_order": 3
133+
}
134+
]
135+
}'
88136
```
89137

90-
> Request body
91-
92-
```json
93-
{
94-
"ranks": [
95-
{
96-
"id": 319,
97-
"title": "TITLE",
98-
"description": "DESCRIPTION",
99-
"permissions": "{\"view_news\":true,\"org_admin\":true,\"panel_printing\":true,\"printer_restart\":true,\"printer_edit\":true,\"bed_leveling\":true,\"gcode_profiles\":true,\"printer_settings\":true,\"filament_settings\":true,\"change_filament\":true,\"create_filament\":true,\"see_filament_tab\":true,\"view_users\":true,\"change_user_rank\":true,\"manual_user_email_confirm\":true,\"invite_users\":true,\"delete_user\":true,\"org_user_registration_settings\":true,\"org_hub_settings\":true,\"org_rank_management\":true,\"org_view_statistics\":true,\"refill_quota\":true,\"custom_slicer_profiles\":true,\"org_profiles\":true,\"all_slicer_modes\":true,\"queue_remove_all\":true,\"org_api\":true,\"create_org_folder\":true,\"cancel_others\":true,\"see_who_printed\":true,\"max_print_size\":[],\"default_slicer_mode\":2}",
100-
"sort_order": 3
101-
}
102-
]
103-
}
104-
```
105138

106139
> Success repsonse
107140
@@ -116,7 +149,38 @@ curl https://api.simplyprint.io/{id}/account/settings/groups/Update \
116149
"description": "DESCRIPTION",
117150
"company_id": 2,
118151
"company_type": 2,
119-
"permissions": "{\"view_news\":true,\"org_admin\":true,\"panel_printing\":true,\"printer_restart\":true,\"printer_edit\":true,\"bed_leveling\":true,\"gcode_profiles\":true,\"printer_settings\":true,\"filament_settings\":true,\"change_filament\":true,\"create_filament\":true,\"see_filament_tab\":true,\"view_users\":true,\"change_user_rank\":true,\"manual_user_email_confirm\":true,\"invite_users\":true,\"delete_user\":true,\"org_user_registration_settings\":true,\"org_hub_settings\":true,\"org_rank_management\":true,\"org_view_statistics\":true,\"refill_quota\":true,\"custom_slicer_profiles\":true,\"org_profiles\":true,\"all_slicer_modes\":true,\"queue_remove_all\":true,\"org_api\":true,\"create_org_folder\":true,\"cancel_others\":true,\"see_who_printed\":true,\"max_print_size\":[],\"default_slicer_mode\":2}",
152+
"permissions": {
153+
"view_news": true,
154+
"org_admin": true,
155+
"panel_printing": true,
156+
"printer_restart": true,
157+
"printer_edit": true,
158+
"bed_leveling": true,
159+
"gcode_profiles": true,
160+
"printer_settings": true,
161+
"filament_settings": true,
162+
"change_filament": true,
163+
"create_filament": true,
164+
"see_filament_tab": true,
165+
"view_users": true,
166+
"change_user_rank": true,
167+
"manual_user_email_confirm": true,
168+
"invite_users": true,
169+
"delete_user": true,
170+
"org_user_registration_settings": true,
171+
"org_hub_settings": true,
172+
"org_rank_management": true,
173+
"org_view_statistics": true,
174+
"refill_quota": true,
175+
"custom_slicer_profiles": true,
176+
"org_profiles": true,
177+
"all_slicer_modes": true,
178+
"queue_remove_all": true,
179+
"org_api": true,
180+
"create_org_folder": true,
181+
"cancel_others": true,
182+
"see_who_printed": true,
183+
},
120184
"sort_order": 3,
121185
"created": "2023-01-03 14:35:28"
122186
}
@@ -144,7 +208,7 @@ This endpoint updates the groups in the company.
144208
| `ranks[].id` | integer | yes | The id of the group to update. |
145209
| `ranks[].title` | string | no | The name of the group. |
146210
| `ranks[].description` | string | no | The description of the group. |
147-
| `ranks[].permissions` | string | no | JSON string of the permissions of the group. For more information, see [Permissions](#permissions). |
211+
| `ranks[].permissions` | object | no | Object containing permissions for the group. Use permission strings from the [Permissions](#permissions) table as keys with boolean values. |
148212
| `ranks[].sort_order` | integer | no | The sort index of the group. |
149213

150214
### Response
@@ -159,7 +223,7 @@ This endpoint updates the groups in the company.
159223
| `data[].description` | string | The description of the group. |
160224
| `data[].company_id` | integer | The id of the company. |
161225
| `data[].company_type` | integer | The type of the company. |
162-
| `data[].permissions` | string | JSON string of the permissions of the group. For more information, see [Permissions](#permissions). |
226+
| `data[].permissions` | object | Object containing permissions for the group. Use permission strings from the [Permissions](#permissions) table as keys with boolean values. |
163227
| `data[].sort_order` | integer | The sort order of the group. |
164228
| `data[].created` | string | The date and time the group was created. |
165229

@@ -210,31 +274,26 @@ This endpoint returns a list of groups that exist in the company.
210274

211275
### Response
212276

213-
| Parameter | Type | Description |
214-
|-----------------|---------|-------------------------------------|
215-
| `status` | boolean | True if the request was successful. |
216-
| `message` | string | Error message if `status` is false. |
217-
| `groups` | array | Array of group objects. |
218-
| `groups[].id` | integer | Group ID. |
219-
| `groups[].name` | string | Group name. |
277+
| Parameter | Type | Description |
278+
|-----------------------|---------|-------------------------------------|
279+
| `status` | boolean | True if the request was successful. |
280+
| `message` | string | Error message if `status` is false. |
281+
| `groups` | array | Array of group objects. |
282+
| `groups[].id` | integer | Group ID. |
283+
| `groups[].name` | string | Group name. |
284+
| `groups[].description`| string | Group description. |
220285

221286
## Delete company group
222287

223288
```shell
224289
curl https://api.simplyprint.io/{id}/account/settings/groups/Delete \
225290
-X POST \
226291
-H 'accept: application/json' \
227-
-H 'X-API-KEY: {API_KEY}'
292+
-H 'Content-Type: application/json' \
293+
-H 'X-API-KEY: {API_KEY}' \
294+
-d '{"id": 112, "replacementRankId": 151}'
228295
```
229296

230-
> Request body
231-
232-
```json
233-
{
234-
"id": 112,
235-
"replacementRankId": 151
236-
}
237-
```
238297

239298
> Success response
240299
@@ -275,27 +334,11 @@ curl https://api.simplyprint.io/{id}/account/settings/groups/Delete \
275334
curl https://api.simplyprint.io/{id}/account/GetStatistics \
276335
-X POST \
277336
-H 'accept: application/json' \
278-
-H 'X-API-KEY: {API_KEY}'
337+
-H 'Content-Type: application/json' \
338+
-H 'X-API-KEY: {API_KEY}' \
339+
-d '{"users": [1234, 1235, 1945], "printers": [1234, 1235, 1945], "start_date": "1677629786", "end_date": "1677629786"}'
279340
```
280341

281-
> Request body
282-
283-
```json
284-
{
285-
"users": [
286-
1234,
287-
1235,
288-
1945
289-
],
290-
"printers": [
291-
1234,
292-
1235,
293-
1945
294-
],
295-
"start_date": "1677629786",
296-
"end_date": "1677629786"
297-
}
298-
```
299342

300343
> Success response
301344

source/includes/_api_files.md

Lines changed: 61 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,71 @@ curl -X POST "https://files.simplyprint.io/{id}/files/Upload" \
8282
### Request
8383

8484
| Parameter | Type | Required | Description |
85-
|-----------------|---------|----------|----------------------------------------------------------------------------------------------------------|
85+
| --------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------- |
8686
| `file` | file | yes | Uploaded file (Max 100mb) |
8787
| `continueToken` | string | no | Optional token you'll get if you need to continue the upload for files greater than 100MB. |
8888
| `totalSize` | integer | no | Send this if you want a continueToken, by providing the total size of the entire file you want to upload |
8989

9090
### Response
9191

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 |
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 |
101+
| `file.uploaded_at` | string | ISO timestamp when the file was uploaded. |
102+
| `file.expires_at` | string | ISO timestamp when the file will expire. |
103+
104+
## List existing API files
105+
106+
<aside class="notice">
107+
This endpoint requires the <b>Print Farm</b> plan.
108+
</aside>
109+
110+
```shell
111+
curl https://files.simplyprint.io/{id}/files/ListExisting \
112+
-H 'accept: application/json' \
113+
-H 'X-API-KEY: {API_KEY}'
114+
```
115+
116+
> Success response
117+
118+
```json
119+
{
120+
"status": true,
121+
"message": null,
122+
"files": [
123+
{
124+
"id": "f568ead4bbc2d881efc8a9a05f3bd585334cd8c662347ba2dfad7250176b0abd",
125+
"name": "sample_file.gcode",
126+
"size": 13439,
127+
"uploaded": "2024-01-15T10:30:00Z",
128+
"expires": "2024-01-22T10:30:00Z"
129+
}
130+
]
131+
}
132+
```
133+
134+
This endpoint returns a list of all existing API files that haven't expired for the current user and company.
135+
136+
### Request
137+
138+
`GET /{id}/files/ListExisting`
139+
140+
### Response
141+
142+
| Parameter | Type | Description |
143+
| --------------------- | ------- | ----------------------------------------- |
144+
| `status` | boolean | True if the request was successful. |
145+
| `message` | string | Error message if `status` is false. |
146+
| `files` | array | Array of existing API file objects. |
147+
| `files[].id` | string | The API File ID. |
148+
| `files[].name` | string | Name of the file. |
149+
| `files[].size` | integer | Size of the file in bytes. |
150+
| `files[].uploaded_at` | string | ISO timestamp when the file was uploaded. |
151+
| `files[].expires_at` | string | ISO timestamp when the file will expire. |
101152

source/includes/_courses.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ curl -X POST https://api.simplyprint.io/{id}/courses/MoveCourse \
124124
|----------------------|
125125
| `courses_manage` |
126126

127-
`POST /{id}courses/MoveCourse`
127+
`POST /{id}/courses/MoveCourse`
128128

129129
### Request Body
130130

source/includes/_custom_fields.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,22 +208,24 @@ curl -X POST https://api.simplyprint.io/{id}/custom_fields/SetEnabled \
208208
|------------------------|
209209
| `custom_fields_manage` |
210210

211-
`GET /{id}/custom_fields/Delete`
211+
`POST /{id}/custom_fields/Delete`
212212

213213
> Example request
214214
215215
```shell
216216
curl https://api.simplyprint.io/{id}/custom_fields/Delete?id=123 \
217-
-H 'accept: application/json' \
218-
-H 'X-API-KEY: {API_KEY}'
217+
-X POST \
218+
-H 'accept: application/json' \
219+
-H 'X-API-KEY: {API_KEY}'
219220
```
220221

221222
> Example request with multiple IDs
222223
223224
```shell
224-
curl https://api.simplyprint.io/{id}custom_fields/Delete?ids=123,124,125 \
225-
-H 'accept: application/json' \
226-
-H 'X-API-KEY: {API_KEY}'
225+
curl https://api.simplyprint.io/{id}/custom_fields/Delete?ids=123,124,125 \
226+
-X POST \
227+
-H 'accept: application/json' \
228+
-H 'X-API-KEY: {API_KEY}'
227229
```
228230

229231
> Example response

0 commit comments

Comments
 (0)