> For the complete documentation index, see [llms.txt](https://docs.mavenseed.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mavenseed.com/developers/api/lessons.md).

# Lessons

## All Lessons

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

Retrieve all lessons

#### 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 lessons. Only the first 20 are returned. Passing the page param will paginate the results.
" %}

```ruby
[
    {
        "id": 25,
        "lessonable_type": "Chapter",
        "lessonable_id": 9,
        "title": "Lighting Window",
        "slug": "lighting-window",
        "content": "In this lesson we'll take a look at the lighting window. In this window we can adjust various global illumination settings such as ambient light, lightmaps, and light \"bounce\". This window will become invaluable to adjusting the overall light within your game. To learn more about the lighting window click here: http://docs.unity3d.com/Manual/GlobalIllumination.html",
        "status": "draft",
        "created_at": "2019-02-22T11:22:18.862-05:00",
        "updated_at": "2019-02-22T11:22:18.862-05:00",
        "ordinal": 2,
        "exercise_votes_threshold": null,
        "exercise_type": 0,
        "free": false,
        "media_type": "text"
    },
    {
        "id": 26,
        "lessonable_type": "Chapter",
        "lessonable_id": 9,
        "title": "Directional Lights",
        "slug": "directional-lights",
        "content": "In this lesson we'll take a look at the most common light you'll encounter whenever you create a scene in Unity. The directional light will act as a sun and is typically used to provide lighting for big, open areas like an outdoor scene. The directional light in Unity 5 is connected to the procedural skybox by default making it easy to create a sunset type of effect. I'll also show you how to add light flares to create a realistic sun flare facing the camera. To learn more about lighting click here: http://docs.unity3d.com/Manual/UsingLights.html",
        "status": "draft",
        "created_at": "2019-02-22T11:23:06.111-05:00",
        "updated_at": "2019-02-22T11:23:06.111-05:00",
        "ordinal": 1,
        "exercise_votes_threshold": null,
        "exercise_type": 0,
        "free": false,
        "media_type": "text"
    }
]
```

{% endtab %}
{% endtabs %}

## Show Lesson

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

Retrieve a single lesson

#### Headers

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

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

```ruby
{
    "id": 25,
    "lessonable_type": "Chapter",
    "lessonable_id": 9,
    "title": "Lighting Window",
    "slug": "lighting-window",
    "content": "In this lesson we'll take a look at the lighting window. In this window we can adjust various global illumination settings such as ambient light, lightmaps, and light \"bounce\". This window will become invaluable to adjusting the overall light within your game. To learn more about the lighting window click here: http://docs.unity3d.com/Manual/GlobalIllumination.html",
    "status": "draft",
    "created_at": "2019-02-22T11:22:18.862-05:00",
    "updated_at": "2019-02-22T11:22:18.862-05:00",
    "ordinal": 2,
    "exercise_votes_threshold": null,
    "exercise_type": 0,
    "free": false,
    "media_type": "text"
}
```

{% endtab %}

{% tab title="404 " %}

```ruby
null
```

{% endtab %}
{% endtabs %}

## Create Lesson

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

Create a lesson. \
\
Note: **slugs** are created automatically from the title, but can updated with the PATCH call below.

#### Headers

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

#### Request Body

| Name                      | Type    | Description                    |
| ------------------------- | ------- | ------------------------------ |
| lessonable\_id            | integer | ID of the type of lesson below |
| lessonable\_type          | string  | Chapter                        |
| title                     | string  | Title of the lesson            |
| content                   | string  | Lesson content                 |
| status                    | integer | 0 - draft, 1 - published       |
| ordinal                   | integer | Order in course                |
| exercise\_votes\_thresold | integer | NUmber of votes                |
| exercise\_type            | string  |                                |
| free                      | string  |                                |
| media\_type               | string  |                                |

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

```ruby
{
    "id": 25,
    "lessonable_type": "Chapter",
    "lessonable_id": 9,
    "title": "Lighting Window",
    "slug": "lighting-window",
    "content": "In this lesson we'll take a look at the lighting window. In this window we can adjust various global illumination settings such as ambient light, lightmaps, and light \"bounce\". This window will become invaluable to adjusting the overall light within your game. To learn more about the lighting window click here: http://docs.unity3d.com/Manual/GlobalIllumination.html",
    "status": "draft",
    "created_at": "2019-02-22T11:22:18.862-05:00",
    "updated_at": "2019-02-22T11:22:18.862-05:00",
    "ordinal": 2,
    "exercise_votes_threshold": null,
    "exercise_type": 0,
    "free": false,
    "media_type": "text"
}
```

{% endtab %}
{% endtabs %}

## Update Lesson

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

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

#### Headers

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

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

```ruby
{
    "id": 25,
    "lessonable_type": "Chapter",
    "lessonable_id": 9,
    "title": "Lighting Window",
    "slug": "lighting-window",
    "content": "In this lesson we'll take a look at the lighting window. In this window we can adjust various global illumination settings such as ambient light, lightmaps, and light \"bounce\". This window will become invaluable to adjusting the overall light within your game. To learn more about the lighting window click here: http://docs.unity3d.com/Manual/GlobalIllumination.html",
    "status": "draft",
    "created_at": "2019-02-22T11:22:18.862-05:00",
    "updated_at": "2019-02-22T11:22:18.862-05:00",
    "ordinal": 2,
    "exercise_votes_threshold": null,
    "exercise_type": 0,
    "free": false,
    "media_type": "text"
}
```

{% endtab %}
{% endtabs %}

## Delete a Lesson

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

Delete a lesson.

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}
