Skip to content

Commit fba91b0

Browse files
committed
Documented endpoints
1 parent fe23a5b commit fba91b0

File tree

5 files changed

+378
-2
lines changed

5 files changed

+378
-2
lines changed

source/includes/_account.md

+4
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ curl https://api.simplyprint.io/{id}/account/GetStatistics \
333333
}
334334
```
335335

336+
<aside class="notice">
337+
This endpoint requires the <b>Pro</b> plan.
338+
</aside>
339+
336340
This endpoint returns statistics for the user / company.
337341

338342
### Request

source/includes/_files.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Files
22

3-
## Get Files
3+
## List Files and Folders
44

55
```shell
66
curl https://api.simplyprint.io/{id}/files/GetFiles?f=123&search=benchy \

source/includes/_jobs.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Print Jobs
2+
3+
## Get Print Jobs
4+
5+
```shell
6+
curl https://api.simplyprint.io/{id}/jobs/GetPaginatedPrintJobs \
7+
-X POST \
8+
-H 'accept: application/json' \
9+
-H 'X-API-KEY: {API_KEY}'
10+
```
11+
12+
> Request body
13+
14+
```json
15+
{
16+
"page": 1,
17+
"page_size": 10,
18+
"printer_ids": [385],
19+
"status": ["cancelled", "finished"],
20+
"start_date": "2023-02-28"
21+
}
22+
```
23+
24+
> Success response
25+
26+
```json
27+
{
28+
"status": true,
29+
"message": null,
30+
"data": [
31+
{
32+
"id": 549145,
33+
"uid": "7df103aa-b12c-4b33-8305-b55f91c11a4d",
34+
"status": "cancelled",
35+
"cancelReasonType": "5",
36+
"rating": -2,
37+
"filename": "Benchy.gcode",
38+
"startDate": "2023-02-28T21:05:50+00:00",
39+
"endDate": "2023-02-28T21:06:07+00:00",
40+
"user": 5933,
41+
"printer": 385,
42+
"filament": "{\"e0\": {\"usage\": 60}}",
43+
"filUsage": 60,
44+
"filUsageGram": 0,
45+
"currentPercentage": 48,
46+
"printTime": 17
47+
},
48+
...
49+
],
50+
"page_amount": 1
51+
}
52+
```
53+
54+
Get paginated data about ongoing or finished print jobs.
55+
56+
### Request
57+
58+
`POST /{id}/jobs/GetPaginatedPrintJobs`
59+
60+
| Parameter | Type | Required | Description |
61+
|-----------|------|----------|-------------|
62+
| `page` | integer | yes | The page number to get. |
63+
| `page_size` | integer | yes | The number of items per page. (Between 1 and 100) |
64+
| `printer_types[]` | integer[] | no | Array of printer type ids to filter on. |
65+
| `printer_ids[]` | integer[] | no | Array of printer ids to filter on. |
66+
| `user_ids[]` | integer[] | no | Array of user ids to filter on. |
67+
| `accepted_statuses[]` | string[] | no | Array of job statuses to filter on. One of `ongoing`, `cancelled`, `failed`, `done`. |
68+
| `start_date` | string | no | The start date to filter on. In unix timestamp format. Can be set without `end_date`. |
69+
| `end_date` | string | no | The end date to filter on. In unix timestamp format. Can be set without `start_date`. |
70+
71+
### Response
72+
73+
| Parameter | Type | Description |
74+
| --------- | ---- | ----------- |
75+
| `status` | boolean | True if the request was successful. |
76+
| `message` | string | Error message if `status` is false. |
77+
| `data` | array | The jobs. |
78+
| `data[].id` | integer | The job id. |
79+
| `data[].uid` | string | The job uid. |
80+
| `data[].status` | string | The job status. One of `ongoing`, `cancelled`, `failed`, `done`. |
81+
| `data[].cancelReasonType` | string | The job cancel reason type. |
82+
| `data[].rating` | integer | The job rating. |
83+
| `data[].filename` | string | The job filename. |
84+
| `data[].startDate` | string | The job start date. |
85+
| `data[].endDate` | string/null | The job end date. Is null if the job is ongoing. |
86+
| `data[].user` | integer | The user id of the user who started the job. |
87+
| `data[].printer` | integer | The printer id that was used to print the job. |
88+
| `data[].filament` | string | The filament usage. JSON encoded string with usage per extruder. |
89+
| `data[].filUsage` | integer | The filament usage in mm. |
90+
| `data[].filUsageGram` | integer | The filament usage in grams. |
91+
| `data[].currentPercentage` | integer | The current percentage of the job. |
92+
| `page_amount` | integer | The total number of pages for the given parameters. |

source/includes/_users.md

+271
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
# User Management
2+
3+
## Create Invitation Link
4+
5+
```shell
6+
curl https://api.simplyprint.io/{id}/users/CreateInvitationLink \
7+
-X POST \
8+
-H 'accept: application/json' \
9+
-H 'X-API-KEY: {API_KEY}'
10+
```
11+
12+
> Request body
13+
14+
```json
15+
{
16+
"maxUses": 10
17+
}
18+
```
19+
20+
> Success response
21+
22+
```json
23+
{
24+
"status": true,
25+
"message": null,
26+
"link": "https://simplyprint.io/accept_invitation/b3d9b5a0-5b5b-11e9-8d7c-2d3b9e84aafd"
27+
}
28+
```
29+
30+
<aside class="notice">
31+
This endpoint requires the <b>Print Farm</b> plan.
32+
</aside>
33+
34+
| Required permissions |
35+
| -------------------- |
36+
| `INVITE_USERS` |
37+
38+
This endpoint creates an invitation link that can be used to invite new users to the company.
39+
Please note that links with unlimited uses expire at the end of the day.
40+
41+
### Request
42+
43+
`POST /{id}/users/CreateInvitationLink`
44+
45+
| Parameter | Type | Required | Description |
46+
|-----------|------|----------|-------------|
47+
| `maxUses` | integer | no | The maximum number of times the link can be used. Specify 0 for unlimited uses. |
48+
49+
### Response
50+
51+
| Parameter | Type | Description |
52+
|-----------|------|-------------|
53+
| `status` | boolean | True if the request was successful. |
54+
| `message` | string | Error message if `status` is false. |
55+
| `link` | string | The invitation link. |
56+
57+
## Invite Users By Email
58+
59+
```shell
60+
curl https://api.simplyprint.io/{id}/users/InviteSpecificUser \
61+
-X POST \
62+
-H 'accept: application/json' \
63+
-H 'X-API-KEY: {API_KEY}'
64+
```
65+
66+
> Request body
67+
68+
```json
69+
{
70+
"emails": [
71+
72+
73+
],
74+
"rank": 192,
75+
"lang": "en"
76+
}
77+
```
78+
79+
> Success response
80+
81+
```json
82+
{
83+
"status": true,
84+
"message": null
85+
}
86+
```
87+
88+
<aside class="notice">
89+
This endpoint requires the <b>Print Farm</b> plan.
90+
</aside>
91+
92+
| Required permissions |
93+
| -------------------- |
94+
| `INVITE_USERS` |
95+
96+
This endpoint invites one or more users to the company by email.
97+
98+
### Request
99+
100+
`POST /{id}/users/InviteSpecificUser`
101+
102+
| Parameter | Type | Required | Description |
103+
|-----------|------|----------|-------------|
104+
| `emails` | string[] | yes | The emails of the users to invite. |
105+
| `rank` | integer | no | The rank id that the users should be assigned. |
106+
107+
### Response
108+
109+
| Parameter | Type | Description |
110+
|-----------|------|-------------|
111+
| `status` | boolean | True if the request was successful. |
112+
| `message` | string | Error message if `status` is false. |
113+
114+
## Delete User
115+
116+
```shell
117+
curl https://api.simplyprint.io/{id}/users/DeleteUser \
118+
-X POST \
119+
-H 'accept: application/json' \
120+
-H 'X-API-KEY: {API_KEY}'
121+
```
122+
123+
> Request body
124+
125+
```json
126+
{
127+
"user_id": 1234
128+
}
129+
```
130+
131+
> Success response
132+
133+
```json
134+
{
135+
"status": true,
136+
"message": null
137+
}
138+
```
139+
140+
<aside class="notice">
141+
This endpoint requires the <b>Print Farm</b> plan.
142+
</aside>
143+
144+
| Required permissions |
145+
| -------------------- |
146+
| `DELETE_USER` |
147+
148+
This endpoint deletes a user from the company. Use this endpoint with caution.
149+
150+
### Request
151+
152+
`POST /{id}/users/DeleteUser`
153+
154+
| Parameter | Type | Required | Description |
155+
|-----------|------|----------|-------------|
156+
| `user_id` | integer | yes | The id of the user to delete. |
157+
158+
### Response
159+
160+
| Parameter | Type | Description |
161+
|-----------|------|-------------|
162+
| `status` | boolean | True if the request was successful. |
163+
| `message` | string | Error message if `status` is false. |
164+
165+
## Accept or Deny Pending User
166+
167+
```shell
168+
curl https://api.simplyprint.io/{id}/users/SetPendingUserState \
169+
-X ? \
170+
-H 'accept: application/json' \
171+
-H 'X-API-KEY: {API_KEY}'
172+
```
173+
174+
> Success response
175+
176+
```json
177+
{
178+
"TODO": "TODO"
179+
}
180+
```
181+
182+
### Request
183+
184+
`? /{id}/users/SetPendingUserState`
185+
186+
TODO
187+
188+
## Change User Rank
189+
190+
```shell
191+
curl https://api.simplyprint.io/{id}/users/ChangeUserRank \
192+
-X ? \
193+
-H 'accept: application/json' \
194+
-H 'X-API-KEY: {API_KEY}'
195+
```
196+
197+
> Success response
198+
199+
```json
200+
{
201+
"TODO": "TODO"
202+
}
203+
```
204+
205+
### Request
206+
207+
`? /{id}/users/ChangeUserRank`
208+
209+
TODO
210+
211+
## Get Company Users
212+
213+
```shell
214+
curl https://api.simplyprint.io/{id}/users/GetPaginatedUsers \
215+
-X POST \
216+
-H 'accept: application/json' \
217+
-H 'X-API-KEY: {API_KEY}'
218+
```
219+
220+
> Request body
221+
222+
```json
223+
{
224+
"page": 1,
225+
"page_size": 10,
226+
"approved": true,
227+
"search": "John Doe",
228+
"sort_id": 1,
229+
"sort_dir": "asc"
230+
}
231+
```
232+
233+
> Success response
234+
235+
```json
236+
{
237+
"TODO": "TODO"
238+
}
239+
```
240+
241+
<aside class="notice">
242+
This endpoint requires the <b>Print Farm</b> plan.
243+
</aside>
244+
245+
| Required permissions |
246+
| -------------------- |
247+
| `VIEW_USERS` |
248+
249+
### Request
250+
251+
`POST /{id}/users/GetPaginatedUsers`
252+
253+
| Parameter | Type | Required | Description |
254+
|-----------|------|----------|-------------|
255+
| `page` | integer | yes | The page number to retrieve. |
256+
| `page_size` | integer | yes | The number of users to retrieve per page. |
257+
| `approved` | boolean | no | If true, only approved users will be returned. If false, only pending users will be returned.<br>**Defaults to true** |
258+
| `search` | string | no | A search string to filter the users by. Searches for name, email and phone number. |
259+
| `sort_id` | integer | no | Which field to sort by. See [Sort IDs](#sort-ids). |
260+
| `sort_dir` | string | no | The sort direction. Either `asc` or `desc`. |
261+
262+
#### Sort IDs
263+
264+
| ID | Field |
265+
|----|-------|
266+
| 0 | Name |
267+
| 1 | Email |
268+
| 2 | Rank id |
269+
| 3 | Last online |
270+
| 4 | Join date |
271+
| 5 | Amount of prints |

0 commit comments

Comments
 (0)