Skip to content

Agent: Chapters

List chapters

GET /api/v1/agent/courses/{course_pk}/chapters/

Requires chapters: view.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
course_pk path yes
COURSE_PK="..."
curl -sS -X GET "https://www-dev.yoshuko.com/api/v1/agent/courses/$COURSE_PK/chapters/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY"
import os
import requests

course_pk = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{course_pk}/chapters/"
response = requests.get(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const course_pk = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${course_pk}/chapters/`, {
  method: "GET",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}` }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
200 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.

Create a chapter

POST /api/v1/agent/courses/{course_pk}/chapters/

Requires chapters: edit.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
course_pk path yes

Request body (JSON):

{
  "title": "string",
  "position": 0,
  "is_published": true,
  "requires_previous_chapter": true,
  "sequential_lessons": true
}
COURSE_PK="..."
curl -sS -X POST "https://www-dev.yoshuko.com/api/v1/agent/courses/$COURSE_PK/chapters/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title": "string", "position": 0, "is_published": true, "requires_previous_chapter": true, "sequential_lessons": true}'
import os
import requests

course_pk = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{course_pk}/chapters/"
payload = {
  "title": "string",
  "position": 0,
  "is_published": True,
  "requires_previous_chapter": True,
  "sequential_lessons": True
}
response = requests.post(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, json=payload, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const course_pk = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${course_pk}/chapters/`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "title": "string",
    "position": 0,
    "is_published": true,
    "requires_previous_chapter": true,
    "sequential_lessons": true
  })
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
201 No response body
400 Validation failed; the body names each field.
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.

Get a chapter

GET /api/v1/agent/courses/{course_pk}/chapters/{id}/

Requires chapters: view.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
course_pk path yes
id path yes
COURSE_PK="..."
ID="..."
curl -sS -X GET "https://www-dev.yoshuko.com/api/v1/agent/courses/$COURSE_PK/chapters/$ID/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY"
import os
import requests

course_pk = "..."
id = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{course_pk}/chapters/{id}/"
response = requests.get(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const course_pk = "...";
const id = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${course_pk}/chapters/${id}/`, {
  method: "GET",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}` }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
200 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
404 No such object in this key's organisation.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.

Replace a chapter

PUT /api/v1/agent/courses/{course_pk}/chapters/{id}/

Requires chapters: edit.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
course_pk path yes
id path yes

Request body (JSON):

{
  "title": "string",
  "position": 0,
  "is_published": true,
  "requires_previous_chapter": true,
  "sequential_lessons": true
}
COURSE_PK="..."
ID="..."
curl -sS -X PUT "https://www-dev.yoshuko.com/api/v1/agent/courses/$COURSE_PK/chapters/$ID/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title": "string", "position": 0, "is_published": true, "requires_previous_chapter": true, "sequential_lessons": true}'
import os
import requests

course_pk = "..."
id = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{course_pk}/chapters/{id}/"
payload = {
  "title": "string",
  "position": 0,
  "is_published": True,
  "requires_previous_chapter": True,
  "sequential_lessons": True
}
response = requests.put(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, json=payload, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const course_pk = "...";
const id = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${course_pk}/chapters/${id}/`, {
  method: "PUT",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "title": "string",
    "position": 0,
    "is_published": true,
    "requires_previous_chapter": true,
    "sequential_lessons": true
  })
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
200 No response body
400 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
404 No such object in this key's organisation.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.

Update a chapter

PATCH /api/v1/agent/courses/{course_pk}/chapters/{id}/

Requires chapters: edit.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
course_pk path yes
id path yes

Request body (JSON):

{
  "title": "string",
  "position": 0,
  "is_published": true,
  "requires_previous_chapter": true,
  "sequential_lessons": true
}
COURSE_PK="..."
ID="..."
curl -sS -X PATCH "https://www-dev.yoshuko.com/api/v1/agent/courses/$COURSE_PK/chapters/$ID/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title": "string", "position": 0, "is_published": true, "requires_previous_chapter": true, "sequential_lessons": true}'
import os
import requests

course_pk = "..."
id = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{course_pk}/chapters/{id}/"
payload = {
  "title": "string",
  "position": 0,
  "is_published": True,
  "requires_previous_chapter": True,
  "sequential_lessons": True
}
response = requests.patch(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, json=payload, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const course_pk = "...";
const id = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${course_pk}/chapters/${id}/`, {
  method: "PATCH",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "title": "string",
    "position": 0,
    "is_published": true,
    "requires_previous_chapter": true,
    "sequential_lessons": true
  })
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
200 No response body
400 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
404 No such object in this key's organisation.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.

Delete a chapter

DELETE /api/v1/agent/courses/{course_pk}/chapters/{id}/

Requires chapters: edit.

Authentication: API key — Authorization: Bearer <key>

Parameter In Required Description
course_pk path yes
id path yes
COURSE_PK="..."
ID="..."
curl -sS -X DELETE "https://www-dev.yoshuko.com/api/v1/agent/courses/$COURSE_PK/chapters/$ID/" \
  -H "Authorization: Bearer $YOSHUKO_API_KEY"
import os
import requests

course_pk = "..."
id = "..."
url = f"https://www-dev.yoshuko.com/api/v1/agent/courses/{course_pk}/chapters/{id}/"
response = requests.delete(url, headers={"Authorization": f"Bearer {os.environ['YOSHUKO_API_KEY']}"}, timeout=30)
response.raise_for_status()
print(response.json() if response.content else response.status_code)
const course_pk = "...";
const id = "...";
const response = await fetch(`https://www-dev.yoshuko.com/api/v1/agent/courses/${course_pk}/chapters/${id}/`, {
  method: "DELETE",
  headers: { Authorization: `Bearer ${process.env.YOSHUKO_API_KEY}` }
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(response.status === 204 ? response.status : await response.json());
Status Meaning
204 No response body
401 Missing, unknown, revoked or expired key; or the organisation's plan is inactive (subscription_inactive) or unverified (org_unverified).
403 The key's scope for this resource does not allow the action.
404 No such object in this key's organisation.
429 Rate limited (300 requests/hour per key). Retry after the Retry-After header.