API Learning Online (Admin) | done

Admin Role (kecuali login untuk kedua role(admin,student)). note: setiap akan melakukan crud, membutuhkan token bearer yang didapat setelah login

Register & Login

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

Register Admin

POST https://salmanhack.sanbersy.com/api/v1/register/admin

Request Body

{
    "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
    }
}

Login

POST https://salmanhack.sanbersy.com/api/v1/login

Login untuk admin dan student

Request Body

{
    "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"
    }
}

Playlists

Create playlist

POST https://salmanhack.sanbersy.com/api/v1/admin/playlists

Headers

Request Body

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

Show all playlist

GET https://salmanhack.sanbersy.com/api/v1/admin/playlists

​

Headers

{
    "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"
        }
    ]
}

Show playlist by id

GET https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist

Path Parameters

Headers

{
    "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"
        }
    ]
}

Update playlist by id

PUT https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist

Path Parameters

Headers

Request Body

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

Delete playlist by id

DELETE https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist

​

Path Parameters

Headers

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

Sections

Create Sections of a Playlist

POST https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist/sections

Path Parameters

Headers

Request Body

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

Show all sections of a playlist

GET https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist/sections

Path Parameters

Headers

{
    "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"
        }
    ]
}

Show sections of a playlist by id

GET https://salmanhack.sanbersy.com/api/v1/admin/playlists/:idPlaylist/sections/:idSection

Path Parameters

Headers

{
    "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"
        }
    ]
}

Update section of a playlist by id

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

Path Parameters

Headers

Request Body

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

Delete sections of a playlist by id

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

Path Parameters

Headers

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

Videos

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

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

Create videos of section of playlist

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

Path Parameters

Headers

Request Body

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

Show all videos of section of playlist

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

Path Parameters

Headers

{
    "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"
        }
    ]
}

Show video of section of playlist by id

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

Path Parameters

Headers

{
    "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"
        }
    ]
}

Update video of section of playlist by id

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

Path Parameters

Headers

Request Body

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

Delete video of section of playlist by id

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

Path Parameters

Headers

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

Last updated