# 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
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.intratool.de/api-reference/manual/manual-chapters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
