Skip to content

Commit 3570dbb

Browse files
committed
Document courses and partner endpoints
1 parent 1c69316 commit 3570dbb

File tree

4 files changed

+810
-2
lines changed

4 files changed

+810
-2
lines changed

source/includes/_courses.md

+274
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
# Courses
2+
3+
<aside class="notice">
4+
It is not currently possible to create courses via the API. Contact us if this is a feature you would like to see.
5+
</aside>
6+
7+
## Get course
8+
9+
```shell
10+
curl https://api.simplyprint.io/{id}/courses/GetCourse?id=123 \
11+
-H 'accept: application/json' \
12+
-H 'X-API-KEY: {API_KEY}'
13+
```
14+
15+
> Success response
16+
17+
```json
18+
{
19+
"status": true,
20+
"message": null,
21+
"course": {
22+
// Course details
23+
},
24+
"slides": [
25+
// Course slides
26+
],
27+
"embeds": [
28+
{
29+
"name": "Embed",
30+
"logo": "example.png",
31+
"privacy_policy": "https://example.com/privacy",
32+
"allowed_url": "https://example.com/embed",
33+
"how_to_embed_guide": "https://example.com/embed_guide"
34+
}
35+
]
36+
}
37+
```
38+
39+
| Required permission | Description |
40+
|---------------------|----------------------------|
41+
| `courses_view` | Required to view courses. |
42+
| `courses_manage` | Required for teacher view. |
43+
44+
`GET /{id}/courses/GetCourse`
45+
46+
### Request Parameters
47+
48+
| Parameter | Type | Description |
49+
|----------------|---------|------------------------------------------------------|
50+
| `id` | integer | The ID of the course to retrieve. |
51+
| `teacher_view` | boolean | Whether to retrieve the course in teacher view mode. |
52+
53+
### Response
54+
55+
| Parameter | Type | Description |
56+
|-----------|---------|---------------------------------------|
57+
| `status` | boolean | `true` if the request was successful. |
58+
| `message` | string | Error message if `status` is `false`. |
59+
| `course` | object | The course details. |
60+
| `slides` | array | The slides of the course. |
61+
| `embeds` | array | The embed types for the course. |
62+
63+
## Delete course
64+
65+
```shell
66+
curl -X POST https://api.simplyprint.io/{id}/courses/DeleteCourse \
67+
-H 'accept: application/json' \
68+
-H 'X-API-KEY: {API_KEY}' \
69+
-d '{
70+
"id": 123
71+
}'
72+
```
73+
74+
> Success response
75+
76+
```json
77+
{
78+
"status": true,
79+
"message": null
80+
}
81+
```
82+
83+
| Required permissions |
84+
|----------------------|
85+
| `courses_manage` |
86+
87+
`POST /{id}/courses/DeleteCourse`
88+
89+
### Request Body
90+
91+
| Parameter | Type | Description |
92+
|-----------|---------|---------------------------------|
93+
| `id` | integer | The ID of the course to delete. |
94+
95+
### Response
96+
97+
| Parameter | Type | Description |
98+
|-----------|---------|---------------------------------------|
99+
| `status` | boolean | `true` if the request was successful. |
100+
| `message` | string | Error message if `status` is `false`. |
101+
102+
## Move course
103+
104+
```shell
105+
curl -X POST https://api.simplyprint.io/{id}/courses/MoveCourse \
106+
-H 'accept: application/json' \
107+
-H 'X-API-KEY: {API_KEY}' \
108+
-d '{
109+
"course": 123,
110+
"category": 456
111+
}'
112+
```
113+
114+
> Success response
115+
116+
```json
117+
{
118+
"status": true,
119+
"message": null
120+
}
121+
```
122+
123+
| Required permissions |
124+
|----------------------|
125+
| `courses_manage` |
126+
127+
`POST /{id}courses/MoveCourse`
128+
129+
### Request Body
130+
131+
| Parameter | Type | Description |
132+
|------------|---------|-------------------------------|
133+
| `course` | integer | The ID of the course to move. |
134+
| `category` | integer | The ID of the new category. |
135+
136+
### Response
137+
138+
| Parameter | Type | Description |
139+
|-----------|---------|---------------------------------------|
140+
| `status` | boolean | `true` if the request was successful. |
141+
| `message` | string | Error message if `status` is `false`. |
142+
143+
## Publish/unpublish course
144+
145+
```shell
146+
curl -X POST https://api.simplyprint.io/{id}/courses/PublishCourse \
147+
-H 'accept: application/json' \
148+
-H 'X-API-KEY: {API_KEY}' \
149+
-d '{
150+
"id": 123
151+
}'
152+
```
153+
154+
> Success response
155+
156+
```json
157+
{
158+
"status": true,
159+
"message": null
160+
}
161+
```
162+
163+
| Required permissions |
164+
|----------------------|
165+
| `courses_manage` |
166+
167+
`POST /{id}/courses/PublishCourse`
168+
169+
### Request Parameters
170+
171+
| Parameter | Description |
172+
|-------------|--------------------------------------------------------------|
173+
| `unpublish` | Set if the course should be unpublished (no value required). |
174+
175+
### Request Body
176+
177+
| Parameter | Type | Description |
178+
|-----------|---------|----------------------------------|
179+
| `id` | integer | The ID of the course to publish. |
180+
181+
### Response
182+
183+
| Parameter | Type | Description |
184+
|-----------|---------|---------------------------------------|
185+
| `status` | boolean | `true` if the request was successful. |
186+
| `message` | string | Error message if `status` is `false`. |
187+
188+
## Create/update category
189+
190+
```shell
191+
curl -X POST https://api.simplyprint.io/{id}/courses/CreateCategory \
192+
-H 'accept: application/json' \
193+
-H 'X-API-KEY: {API_KEY}' \
194+
-d '{
195+
"name": "New Category",
196+
"public": true
197+
}'
198+
```
199+
200+
> Success response
201+
202+
```json
203+
{
204+
"status": true,
205+
"message": null,
206+
"category": {
207+
"id": 123,
208+
"name": "New Category",
209+
"public": true
210+
}
211+
}
212+
```
213+
214+
| Required permissions |
215+
|----------------------|
216+
| `courses_manage` |
217+
218+
`POST /{id}/courses/CreateCategory`
219+
220+
### Request Body
221+
222+
| Parameter | Type | Description |
223+
|------------|---------|--------------------------------------------------------------------------|
224+
| `language` | string | The language code (2 characters) (optional). |
225+
| `id` | integer | The ID of the category to update (optional to update existing category). |
226+
| `name` | string | The name of the category. |
227+
| `public` | boolean | Whether the category is public. |
228+
229+
### Response
230+
231+
| Parameter | Type | Description |
232+
|------------|---------|------------------------------------------|
233+
| `status` | boolean | `true` if the request was successful. |
234+
| `message` | string | Error message if `status` is `false`. |
235+
| `category` | object | The created or updated category details. |
236+
237+
## Delete category
238+
239+
```shell
240+
curl -X POST https://api.simplyprint.io/{id}/courses/DeleteCategory \
241+
-H 'accept: application/json' \
242+
-H 'X-API-KEY: {API_KEY}' \
243+
-d '{
244+
"id": 123
245+
}'
246+
```
247+
248+
> Success response
249+
250+
```json
251+
{
252+
"status": true,
253+
"message": null
254+
}
255+
```
256+
257+
| Required permissions |
258+
|----------------------|
259+
| `courses_manage` |
260+
261+
`POST /{id}/courses/DeleteCategory`
262+
263+
### Request Body
264+
265+
| Parameter | Type | Description |
266+
|-----------|---------|-----------------------------------|
267+
| `id` | integer | The ID of the category to delete. |
268+
269+
### Response
270+
271+
| Parameter | Type | Description |
272+
|-----------|---------|---------------------------------------|
273+
| `status` | boolean | `true` if the request was successful. |
274+
| `message` | string | Error message if `status` is `false`. |

0 commit comments

Comments
 (0)