Appearance
Chapters
Chapters (sections) within books. Contributions are assigned to a chapter.
Note: The database entity is called
Formats. The API uses the name "chapter" for clarity.
Routes
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/chapters/:forBook? | Bearer | List chapters (optionally filtered by book ID) |
| GET | /api/chapter/:id | Bearer | Get single chapter |
| PUT | /api/chapter | JWT (admin/root) | Create a chapter |
| POST | /api/chapter/:id | JWT (admin/root) | Update a chapter |
| PATCH | /api/chapter/:id | JWT (admin/root) | Partially update a chapter |
| DELETE | /api/chapter/:id | JWT (admin/root) | Delete a chapter (cascades to contributions) |
List Chapters
GET /api/chapters?query=<JSON>
GET /api/chapters/:forBook?query=<JSON>The optional :forBook path parameter filters chapters by book ID.
Filterable Fields
| Field | Type | Operators |
|---|---|---|
id | number | All numeric operators |
forbook | number | All numeric operators |
name | string | All string operators |
Example
bash
# List chapters for book 1, sorted by sort order
curl -G http://localhost:8080/api/chapters/1 \
-H "Authorization: Bearer API_KEY" \
--data-urlencode 'query={"sort":"sort"}'Create Chapter (PUT)
PUT /api/chapterBody
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name |
id | number | No | Entity ID |
sort | number | No | Sort order |
settings | object | No | Configuration object |
locales | object | No | Locale settings |
rights | array | No | Rights assignments |
book | bookpatchBookPatchParams | Yes | Parent book (id or name) |
Update Chapter (POST)
POST /api/chapter/:idBody
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name |
id | number | No | Entity ID |
sort | number | Yes | Sort order |
settings | object | Yes | Configuration object |
locales | object | Yes | Locale settings |
rights | array | Yes | Rights assignments |
book | bookpatchBookPatchParams | Yes | Parent book (id or name) |
Partial Update (PATCH)
PATCH /api/chapter/:idBody
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Display name |
id | number | No | Entity ID |
sort | number | No | Sort order |
settings | object | No | Configuration object |
locales | object | No | Locale settings |
rights | array | No | Rights assignments |
book | bookpatchBookPatchParams | No | Parent book (id or name) |
Delete Chapter
DELETE /api/chapter/:idCascades: Deletes all contributions within this chapter.