Overview
Resources are learning materials within study plans. Supported types include YouTube videos, playlists, PDFs, articles, Google Drive files, and custom links.Resource Types
youtube-video- YouTube video with auto-fetched metadatayoutube-playlist- Expands into individual video resourcespdf- PDF document with page countarticle- Web article with estimated reading timegoogle-drive- Google Drive filecustom-link- Generic URL
List Resources
GET /api/resources
Get resources for a specific study plan.
Query Parameters
Study plan ID to fetch resources for
Sort order:
order- Plan’s original ordertitle- Alphabetical by titleduration- By estimated timetype- By resource type
Response
Array of resource objects
Applied sort order
Create Resource
POST /api/resources
Create a new resource. Type is auto-detected from URL if not specified.
Request Body
Resource URL
Resource type (auto-detected if omitted):
youtube-video- Single YouTube videoyoutube-playlist- YouTube playlist (creates multiple resources)pdf- PDF documentarticle- Web articlegoogle-drive- Google Drive filecustom-link- Generic link
Resource title (auto-fetched for YouTube, required for others)
YouTube-specific
YouTube video or playlist URL. Metadata is automatically fetched.
PDF-specific
PDF title
Number of pages
Estimated minutes per page
Article-specific
Article title
Estimated reading time in minutes
Google Drive / Custom Link
Resource title (defaults to URL if omitted)
Optional estimated time
Response
Single Resource
“Resource created successfully” or “Resource already exists”
The created resource object
Whether resource was newly created or already existed
YouTube Playlist
Summary of created/existing resources
Array of video resource objects
Number of newly created resources
Number of resources that already existed
Get Resource
GET /api/resources/:id
Get a specific resource by ID.
Path Parameters
Resource ID
Response
Returns the resource object.Get Bulk Resources
GET /api/resources/bulk
Get multiple resources by IDs.
Query Parameters
Comma-separated list of resource IDs
Response
Returns array of resource objects with calculatedtotalTime field.
Update Resource
PUT /api/resources/:id
Update a resource. Requires edit permissions on the associated study plan.
Path Parameters
Resource ID
Request Body
Resource title
Resource URL
Resource description
Resource metadata
Display order
Response
“Resource updated successfully”
Updated resource object
Delete Resource
DELETE /api/resources/:id
Delete a resource. Only the study plan creator can delete. Also removes the resource from the study plan’s resourceIds array.
Path Parameters
Resource ID
Response
“Resource deleted successfully”
Automatic Metadata Fetching
YouTube Videos
When creating a YouTube video resource, the API automatically:- Extracts the video ID from the URL
- Fetches metadata using YouTube Data API
- Stores title, duration, thumbnail, and video ID
YouTube Playlists
When creating a YouTube playlist resource:- Extracts playlist ID from URL
- Fetches all videos in the playlist
- Creates individual
youtube-videoresources for each - Returns array of created resources
Duplicate Detection
The API checks for existing resources by URL to prevent duplicates:- Single resource: Returns existing resource if URL matches
- Playlist: Reuses existing videos, only creates new ones