> For the complete documentation index, see [llms.txt](https://api-learning-online.gitbook.io/api-learning-online/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-learning-online.gitbook.io/api-learning-online/master.md).

# API Learning Online (Admin) | done

## Register & Login

{% embed url="<https://salmanhack.sanbersy.com/onlinelearning/api/v1/~blablabla>" %}

note: patokan main path nya di atas ini ya. mungkin kebawahnya ga kami tulis ulang, yang penting udah tau main path nya

## Register Admin

<mark style="color:green;">`POST`</mark> `https://salmanhack.sanbersy.com/api/v1/register/admin`

#### Request Body

| Name     | Type   | Description       |
| -------- | ------ | ----------------- |
| email    | string | <admin@gmail.com> |
| password | string | 123456            |

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

```
{
    "message": "Register Admin Successfully",
    "user": {
        "email": "admin@gmail.com",
        "role": "admin",
        "created_at": "2021-02-06T19:34:07.787+07:00",
        "updated_at": "2021-02-06T19:34:07.880+07:00",
        "id": 1
    }
}
```

{% endtab %}
{% endtabs %}

## Login

<mark style="color:green;">`POST`</mark> `https://salmanhack.sanbersy.com/api/v1/login`

Login untuk admin dan student

#### Request Body

| Name     | Type   | Description       |
| -------- | ------ | ----------------- |
| email    | string | <admin@gmail.com> |
| password | string | 123456            |

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

```
{
    "message": "login success",
    "user": {
        "id": 2,
        "email": "student@gmail.com",
        "role": "student",
        "remember_me_token": null,
        "created_at": "2021-02-06T23:07:10.000+07:00",
        "updated_at": "2021-02-06T23:07:10.000+07:00"
    },
    "token": {
        "type": "bearer",
        "token": "Mw.JKX5Wj9l9DLFfEM-RA3NmCPrh0drHxhKpTFzEFZfEt9LCfUnPZ3drrgKLHgR"
    }
}
```

{% endtab %}
{% endtabs %}

## Playlists

## Create playlist

<mark style="color:green;">`POST`</mark> `https://salmanhack.sanbersy.com/api/v1/admin/playlists`

#### Headers

| Name         | Type   | Description                      |
| ------------ | ------ | -------------------------------- |
| Bearer token | string | token yang didapat setelah login |

#### Request Body

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| title       | string |             |
| description | string |             |

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

```
{
    "message": "success, data saved"
}
```

{% endtab %}
{% endtabs %}

## Show all playlist

<mark style="color:blue;">`GET`</mark> `https://salmanhack.sanbersy.com/api/v1/admin/playlists`

​

#### Headers

| Name         | Type   | Description                      |
| ------------ | ------ | -------------------------------- |
| Bearer token | string | token yang didapat setelah login |

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

```
{
    "message": "success",
    "data": [
        {
            "id": 1,
            "title": "playlists 1",
            "description": "this is playlist 1",
            "created_at": "2021-02-06T12:45:34.000Z",
            "updated_at": "2021-02-06T12:45:34.000Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Show playlist by id

<mark style="color:blue;">`GET`</mark> `https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |

#### Headers

| Name         | Type   | Description                      |
| ------------ | ------ | -------------------------------- |
| Bearer token | string | token yang didapat setelah login |

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

```
{
    "message": "success",
    "data": [
        {
            "id": 1,
            "title": "playlists 1",
            "description": "this is playlist 1",
            "created_at": "2021-02-06T12:45:34.000Z",
            "updated_at": "2021-02-06T12:45:34.000Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Update playlist by id

<mark style="color:orange;">`PUT`</mark> `https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |

#### Headers

| Name         | Type   | Description                      |
| ------------ | ------ | -------------------------------- |
| Bearer token | string | token yang didapat setelah login |

#### Request Body

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| title       | string |             |
| description | string |             |

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

```
{
    "message": "success, data updated"
}
```

{% endtab %}
{% endtabs %}

## Delete playlist by id

<mark style="color:red;">`DELETE`</mark> `https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist`

​

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

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

```
{
    "message": "success, data deleted"
}
```

{% endtab %}
{% endtabs %}

## Sections

## Create Sections of a Playlist

<mark style="color:green;">`POST`</mark> `https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist/sections`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

#### Request Body

| Name           | Type    | Description                                               |
| -------------- | ------- | --------------------------------------------------------- |
| title          | string  |                                                           |
| serial\_number | integer | nomor urut, mau taro di urutan ke berapa section tersebut |

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

```
{
    "message": "success, data saved"
}
```

{% endtab %}
{% endtabs %}

## Show all sections of a playlist

<mark style="color:blue;">`GET`</mark> `https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist/sections`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

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

```
{
    "message": "success",
    "data": [
        {
            "id": 2,
            "title": "section 1",
            "playlist_id": 2,
            "serial_number": 1,
            "created_at": "2021-02-06T13:43:53.000Z",
            "updated_at": "2021-02-06T13:43:53.000Z"
        },
        {
            "id": 3,
            "title": "section 2",
            "playlist_id": 2,
            "serial_number": 2,
            "created_at": "2021-02-06T13:46:02.000Z",
            "updated_at": "2021-02-06T13:46:02.000Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Show sections of a playlist by id

<mark style="color:blue;">`GET`</mark> `https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist/sections/:idSection`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |
| idSection  | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

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

```
{
    "message": "success",
    "data": [
        {
            "id": 2,
            "title": "section 1",
            "playlist_id": 2,
            "serial_number": 1,
            "created_at": "2021-02-06T13:43:53.000Z",
            "updated_at": "2021-02-06T13:43:53.000Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Update section of a playlist by id

<mark style="color:orange;">`PUT`</mark> `/api/v1/admin/playlists/:idPlaylist/sections/:idSection`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |
| idSection  | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

#### Request Body

| Name           | Type    | Description |
| -------------- | ------- | ----------- |
| title          | string  |             |
| serial\_number | integer |             |

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

```
{
    "message": "success, data updated"
}
```

{% endtab %}
{% endtabs %}

## Delete sections of a playlist by id

<mark style="color:red;">`DELETE`</mark> `/api/v1/admin/playlists/:idPlaylist/sections/:idSection`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |
| idSection  | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

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

```
{
    "message": "success, data deleted"
}
```

{% endtab %}
{% endtabs %}

## Videos

/api/v1/admin/playlists/:idPlaylist/sections/:idSection/videos

/api/v1/admin/playlists/:idPlaylist/sections/:idSection/videos/:idVideo

## Create videos of section of playlist

<mark style="color:green;">`POST`</mark> `/api/v1/admin/playlists/:idPlaylist/sections/:idSection/videos`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |
| idSection  | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

#### Request Body

| Name           | Type    | Description |
| -------------- | ------- | ----------- |
| title          | string  |             |
| description    | string  |             |
| link           | string  |             |
| serial\_number | integer |             |

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

```
{
    "message": "success, data saved"
}
```

{% endtab %}
{% endtabs %}

## Show all videos of section of playlist

<mark style="color:blue;">`GET`</mark> `/api/v1/admin/playlists/:idPlaylist/sections/:idSection/videos`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |
| idSection  | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

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

```
{
    "message": "success",
    "data": [
        {
            "id": 3,
            "title": "video 1",
            "description": "this is the description of video 1",
            "link": "this is a link of youtube video",
            "section_id": 3,
            "serial_number": 1,
            "created_at": "2021-02-06T14:26:29.000Z",
            "updated_at": "2021-02-06T14:26:29.000Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Show video of section of playlist by id

<mark style="color:blue;">`GET`</mark> `/api/v1/admin/playlists/:idPlaylist/sections/:idSection/videos/:idVideo`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |
| idSection  | integer |             |
| idVideo    | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

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

```
{
    "message": "success",
    "data": [
        {
            "id": 3,
            "title": "video 1",
            "description": "this is the description of video 1",
            "link": "this is a link of youtube video",
            "section_id": 3,
            "serial_number": 1,
            "created_at": "2021-02-06T14:26:29.000Z",
            "updated_at": "2021-02-06T14:26:29.000Z"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Update video of section of playlist by id

<mark style="color:orange;">`PUT`</mark> `/api/v1/admin/playlists/:idPlaylist/sections/:idSection/videos/:idVideo`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |
| idSection  | integer |             |
| idVideo    | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

#### Request Body

| Name           | Type   | Description |
| -------------- | ------ | ----------- |
| title          | string |             |
| description    | string |             |
| link           | string |             |
| serial\_number | string |             |

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

```
{
    "message": "success, data updated"
}
```

{% endtab %}
{% endtabs %}

## Delete video of section of playlist by id

<mark style="color:red;">`DELETE`</mark> `/api/v1/admin/playlists/:idPlaylist/sections/:idSection/videos/:idVideo`

#### Path Parameters

| Name       | Type    | Description |
| ---------- | ------- | ----------- |
| idPlaylist | integer |             |
| idSection  | integer |             |
| idVideo    | integer |             |

#### Headers

| Name         | Type   | Description |
| ------------ | ------ | ----------- |
| Bearer token | string |             |

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

```
{
    "message": "success, data deleted"
}
```

{% endtab %}
{% endtabs %}
