# Chapters

## All Chapters

<mark style="color:blue;">`GET`</mark> `https://yoursite.mavenseed.com/api/v1/chapters`

Retrieve all chapters.

#### Path Parameters

| Name | Type    | Description           |
| ---- | ------- | --------------------- |
| page | integer | Results are paginated |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

{% tabs %}
{% tab title="200 Returns an array of chapters." %}

```ruby
[
    {
        "id": 1030,
        "course_id": 424,
        "title": "Chapter One",
        "content": "<p>fdafdsa</p>",
        "created_at": "2020-07-29T11:28:31.494-04:00",
        "updated_at": "2020-07-29T11:28:49.451-04:00",
        "ordinal": 1
    },
    {
        "id": 949,
        "course_id": 384,
        "title": "chapter two",
        "content": "<p>fsda</p>",
        "created_at": "2020-06-08T12:07:54.724-04:00",
        "updated_at": "2020-06-08T12:07:54.724-04:00",
        "ordinal": 2
    }
]
```

{% endtab %}
{% endtabs %}

## Show Chapter

<mark style="color:blue;">`GET`</mark> `https://yoursite.mavenseed.com/api/v1/chapters/:id`

Retrieve a single chapter.

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

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

```ruby
{
    "id": 1030,
    "course_id": 424,
    "title": "Chapter One",
    "content": "<p>fdafdsa</p>",
    "created_at": "2020-07-29T11:28:31.494-04:00",
    "updated_at": "2020-07-29T11:28:49.451-04:00",
    "ordinal": 1
}
```

{% endtab %}
{% endtabs %}

## Create Chapter

<mark style="color:green;">`POST`</mark> `https://yoursite.mavenseed.com/api/v1/chapters`

Create a chapter.

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

#### Request Body

| Name       | Type    | Description                                        |
| ---------- | ------- | -------------------------------------------------- |
| course\_id | string  |                                                    |
| title      | string  | Title of the chapter. Displayed in lesson listing. |
| content    | string  | Chapter description. Displayed in lesson listing.  |
| ordinal    | integer | The position of the chapter in the course.         |

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

```ruby
{
    "id": 1030,
    "course_id": 424,
    "title": "Chapter One",
    "content": "<p>fdafdsa</p>",
    "created_at": "2020-07-29T11:28:31.494-04:00",
    "updated_at": "2020-07-29T11:28:49.451-04:00",
    "ordinal": 1
}
```

{% endtab %}
{% endtabs %}

## Update Chapter

<mark style="color:purple;">`PATCH`</mark> `https://yoursite.mavenseed.com/api/v1/chapters/:id`

Update a single chapter. All of the above properties in create chapter are valid.

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

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

```ruby
{
    "id": 5,
    "title": "Creating a Realistic 3D Photo Scanned Pumpkin",
    "slug": "creating-a-realistic-3d-photo-scanned-pumpkin",
    "status": "published",
    "created_at": "2019-02-20T14:15:01.393-05:00",
    "updated_at": "2019-03-13T00:25:50.419-04:00",
    "scheduled_at": "2019-02-21T12:00:00.000-05:00",
    "published_at": null,
    "excerpt": "In this Blender tutorial course, we’ll be using Meshroom, a free photogrammetry software, and Blender 3D to create a realistic 3D scanned pumpkin!\t",
    "free": true,
    "questions_enabled": true
}
```

{% endtab %}
{% endtabs %}

## Delete a Chapter

<mark style="color:red;">`DELETE`</mark> `https://yoursite.mavenseed.com/api/v1/chapters/:id`

Delete a chapter

#### Path Parameters

| Name | Type   | Description |
| ---- | ------ | ----------- |
|      | string |             |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | Auth token  |

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

```
```

{% endtab %}
{% endtabs %}
