Episodes

The Episodes API provides endpoints for managing TV series episodes. Each episode belongs to a specific season and includes details like title, description, duration, and associated media files.

List Episodes

GET /api/v1/episodes

Query Parameters

Parameter Type Required Description
page integer No Page number (default: 1)
season_id integer No Filter by season ID
title string No Filter by title

Response

{
    "data": [
        {
            "episode_id": 1,
            "title": "Pilot",
            "episode_number": 1,
            "description": "Walter White, a high school chemistry teacher...",
            "duration": "58:00",
            "season": {
                "id": 1,
                "season_number": 1,
                "tv_series": {
                    "id": 1,
                    "title": "Breaking Bad"
                }
            },
            "still": "https://example.com/episodes/breaking-bad-s1e1.jpg"
        }
    ],
    "links": {
        "first": "http://api.example.com/episodes?page=1",
        "last": "http://api.example.com/episodes?page=5",
        "prev": null,
        "next": "http://api.example.com/episodes?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 5,
        "path": "http://api.example.com/episodes",
        "per_page": 24,
        "to": 24,
        "total": 120
    }
}

Get Episode Details

GET /api/v1/episodes/{id}

Path Parameters

Parameter Type Required Description
id integer Yes Episode ID

Response

{
    "data": {
        "episode_id": 1,
        "title": "Pilot",
        "episode_number": 1,
        "description": "Walter White, a high school chemistry teacher...",
        "duration": "58:00",
        "season": {
            "id": 1,
            "season_number": 1,
            "tv_series": {
                "id": 1,
                "title": "Breaking Bad"
            }
        },
        "still": "https://example.com/episodes/breaking-bad-s1e1.jpg",
        "video_files": [
            {
                "video_id": 1,
                "quality": "1080p",
                "url": "https://example.com/videos/breaking-bad-s1e1-1080p.mp4"
            }
        ]
    }
}

Create Episode

POST /api/v1/episodes

Request Body

Field Type Required Description
season_id integer Yes ID of the season
title string Yes Episode title
episode_number integer Yes Episode number within the season
description string Yes Episode description
duration string Yes Duration in format HH:MM:SS

Example Request

curl -X POST /api/v1/episodes \
    -H "Authorization: Bearer {token}" \
    -H "Content-Type: application/json" \
    -d '{
        "season_id": 1,
        "title": "Pilot",
        "episode_number": 1,
        "description": "Walter White, a high school chemistry teacher...",
        "duration": "58:00"
    }'

Response

{
    "message": "Episode created successfully",
    "data": {
        "episode_id": 1,
        "season_id": 1,
        "title": "Pilot",
        "episode_number": 1,
        "duration": "58:00"
    }
}

Note: For managing episode media files, please refer to the Images and Video Files documentation.