|
| 1 | +# Explore Videos — Frontend Integration Guide |
| 2 | + |
| 3 | +## Endpoint |
| 4 | + |
| 5 | +``` |
| 6 | +GET /api/v1/videos/latest |
| 7 | +``` |
| 8 | + |
| 9 | +No authentication required (public endpoint). |
| 10 | + |
| 11 | +## Query Parameters |
| 12 | + |
| 13 | +| Parameter | Type | Default | Range | Description | |
| 14 | +|------------|------|---------|--------|----------------------| |
| 15 | +| `page` | int | 1 | >= 1 | Page number | |
| 16 | +| `pageSize` | int | 10 | 1–100 | Items per page | |
| 17 | + |
| 18 | +## Example Request |
| 19 | + |
| 20 | +``` |
| 21 | +GET /api/v1/videos/latest?page=1&pageSize=12 |
| 22 | +``` |
| 23 | + |
| 24 | +## Response Shape |
| 25 | + |
| 26 | +```json |
| 27 | +{ |
| 28 | + "data": [ |
| 29 | + { |
| 30 | + "videoId": "uuid", |
| 31 | + "title": "Video Title", |
| 32 | + "thumbnailUrl": "https://i.ytimg.com/vi/.../hqdefault.jpg", |
| 33 | + "userId": "uuid", |
| 34 | + "submittedAt": "2025-12-01T14:30:00Z", |
| 35 | + "content_rating": null, |
| 36 | + "category": null |
| 37 | + } |
| 38 | + ], |
| 39 | + "pagination": { |
| 40 | + "currentPage": 1, |
| 41 | + "pageSize": 12, |
| 42 | + "totalItems": 47, |
| 43 | + "totalPages": 4 |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +## Key Fields in Each Video |
| 49 | + |
| 50 | +| Field | Type | Notes | |
| 51 | +|-----------------|-------------|------------------------------------------| |
| 52 | +| `videoId` | UUID string | Use for routing to `/videos/{videoId}` | |
| 53 | +| `title` | string | Display name | |
| 54 | +| `thumbnailUrl` | URL or null | YouTube thumbnail; use placeholder if null | |
| 55 | +| `userId` | UUID string | Uploader's user ID | |
| 56 | +| `submittedAt` | ISO 8601 | When the video was added | |
| 57 | +| `content_rating`| string/null | Optional content rating | |
| 58 | +| `category` | string/null | Optional category | |
| 59 | + |
| 60 | +## Pagination |
| 61 | + |
| 62 | +Use `pagination.totalPages` to render page controls. To fetch the next page: |
| 63 | + |
| 64 | +``` |
| 65 | +GET /api/v1/videos/latest?page=2&pageSize=12 |
| 66 | +``` |
| 67 | + |
| 68 | +## Suggested UX |
| 69 | + |
| 70 | +- Default to `pageSize=12` (works well in 3- or 4-column grids) |
| 71 | +- Show video cards with thumbnail, title, and submission date |
| 72 | +- Link each card to the video detail page using `videoId` |
| 73 | +- Use `totalItems` to show "Showing X of Y videos" |
| 74 | +- Consider infinite scroll or "Load More" using incrementing `page` values |
| 75 | + |
| 76 | +## Sort Order |
| 77 | + |
| 78 | +Videos are sorted **newest first** (by `submittedAt` descending). There is currently no parameter to change sort order. |
0 commit comments