> For the complete documentation index, see [llms.txt](https://docs.api.intratool.de/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.intratool.de/api-reference/manual/manual-chapters.md).

# ManualChapters

## Introduction

`ManualChapters` are a collection of [ManualEntries](/api-reference/manual/manual-entries.md) and describe structure and permissions for `Manual` contents.

## Model Definition

### Alias

`manualChapter`

### Relations

| Key           | Relation                                                 | Type            | Relation Field(s)                   |
| ------------- | -------------------------------------------------------- | --------------- | ----------------------------------- |
| `departments` | [Departments](/api-reference/departments.md)             | Belongs to many | Intermediate table                  |
| `entries`     | [ManualEntries](/api-reference/manual/manual-entries.md) | Has many        | `manual_chapter_entries.chapter_id` |

### Traits

* `Sortable`

## List

Get a list of all `ManualChapters` the current authenticated [User](/api-reference/users.md) is allowed to view.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/manual/chapters`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/manual/chapters', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
[
  {
    "id": 1,
    "icon_id": 20,
    "name": "Chapter 1",
    "slug": "chapter-1",
    "sort_number": 1,
    "created_at": "2019-01-24 14:07:25",
    "updated_at": "2019-01-24 14:07:25"
  },
  {
    "id": 2,
    "icon_id": 20,
    "name": "Chapter 2",
    "slug": "chapter-2",
    "sort_number": 2,
    "created_at": "2019-01-24 14:08:02",
    "updated_at": "2019-01-24 14:08:02"
  }
]
```

## Show

Show a single `ManualChapter` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/manual/chapters/{id}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/manual/chapters/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "id": 1,
  "icon_id": 20,
  "name": "Chapter 1",
  "slug": "chapter-1",
  "sort_number": 1,
  "created_at": "2019-01-24 14:08:02",
  "updated_at": "2019-01-24 14:08:02"
}
```

## \[Adm.] List

Get a list of all `ManualChapters`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/administration/manual/chapters`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/manual/chapters', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
[
  {
    "id": 1,
    "icon_id": 20,
    "name": "Chapter 1",
    "slug": "chapter-1",
    "sort_number": 1,
    "created_at": "2019-01-24 14:07:25",
    "updated_at": "2019-01-24 14:07:25"
  },
  {
    "id": 2,
    "icon_id": 20,
    "name": "Chapter 2",
    "slug": "chapter-2",
    "sort_number": 2,
    "created_at": "2019-01-24 14:08:02",
    "updated_at": "2019-01-24 14:08:02"
  }
]
```

## \[Adm.] Get

Get a single `ManualChapter` by `id`.

**Definition**

<mark style="color:green;">`GET`</mark> `/api/administration/manual/chapters/{id}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/administration/manual/chapters/1', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "id": 1,
  "icon_id": 20,
  "name": "Chapter 1",
  "slug": "chapter-1",
  "sort_number": 1,
  "created_at": "2019-01-24 14:08:02",
  "updated_at": "2019-01-24 14:08:02"
}
```

## \[Adm.] Create

Create a new `ManualChapter`.

**Definition**

<mark style="color:yellow;">`POST`</mark> `/api/administration/manual/chapters`

**Request Keys**

| Key              | Type    | Default            | Description                                                                                                                                                         |
| ---------------- | ------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `icon_id`        | integer | `20`               | The [Icon](/api-reference/icons.md) of the `ManualChapter`.                                                                                                         |
| `name`\*         | string  | -                  | The name of the `ManualChapter` (unique by all `ManualChapters`).                                                                                                   |
| `slug`           | string  | Slugged `name`     | The slugged `name` of the `ManualChapter` (unique by all `ManualChapters`).                                                                                         |
| `sort_number`    | integer | Current highest +1 | The index of the `ManualChapter`.                                                                                                                                   |
| `department_ids` | string  | -                  | The [Departments](/api-reference/departments.md) that are allowed to see the `ManualChapter` (separated by commas). When empty, the `ManualChapter` will be public. |

Keys with `*` are required.

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/administration/manual/chapters', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'name' => 'Chapter 3',
        'department_ids' => '2,3'
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "status": "success",
  "data": {
    "name": "Chapter 3",
    "icon_id": 20,
    "slug": "chapter-3",
    "sort_number": 3,
    "updated_at": "2019-01-25 15:13:21",
    "created_at": "2019-01-25 15:13:21",
    "id": 3
  }
}
```

## \[Adm.] Update

Update an existing `ManualChapter` by `id`.

**Definition**

<mark style="color:blue;">`PUT`</mark> `/api/administration/manual/chapters/{id}`

**Request Keys**

| Key              | Type    | Description                                                                                                                                                         |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `icon_id`        | integer | The [Icon](/api-reference/icons.md) of the `ManualChapter`.                                                                                                         |
| `name`           | string  | The name of the `ManualChapter` (unique by all `ManualChapters`).                                                                                                   |
| `slug`           | string  | The slugged `name` of the `ManualChapter` (unique by all `ManualChapters`).                                                                                         |
| `sort_number`    | integer | The index of the `ManualChapter`.                                                                                                                                   |
| `department_ids` | string  | The [Departments](/api-reference/departments.md) that are allowed to see the `ManualChapter` (separated by commas). When empty, the `ManualChapter` will be public. |

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/administration/manual/chapters/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"],
    'json' => [
        'name' => 'Chapter3',
        'sort_number' => 1
    ]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "status": "success",
  "data": {
    "name": "Chapter3",
    "icon_id": 20,
    "slug": "chapter3",
    "sort_number": 1,
    "updated_at": "2019-01-25 15:13:21",
    "created_at": "2019-01-25 15:22:46",
    "id": 3
  }
}
```

## \[Adm.] Delete

Delete an existing `ManualChapter` by `id`.

**Definition**

<mark style="color:red;">`DELETE`</mark> `/api/administration/manual/chapters/{id}`

**Example Request**

{% tabs %}
{% tab title="PHP" %}

```php
$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/administration/manual/chapters/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);
```

{% endtab %}
{% endtabs %}

**Example Response Body**

```json
{
  "status": "success",
  "data": null
}
```
