비디오 API
비디오 API는 비디오 콘텐츠를 가져올 수 있는 주요 엔드포인트입니다. 강력한 필터링, 정렬 및 태그 기능을 지원합니다.
비디오 목록
페이지당 비디오 목록을 가져옵니다. 이 엔드포인트는 결과를 세밀하게 조정할 수 있도록 여러 쿼리 매개변수를 허용합니다. 응답에는 비디오 요약 객체가 포함됩니다.
GET /videos
쿼리 매개변수
이름 | 타입 | 설명 |
---|---|---|
path | string | 선택 사항. 특정 컬렉션 경로에 필터링할 수 있습니다. 예: root/movies . |
filters | object | 선택 사항. 메타데이터를 필터링합니다. 필터링 예제 참조 |
tags | string | 선택 사항. 태그 목록을 필터링할 수 있습니다 (예: laravel,api ). 모든 지정된 태그가 있는 비디오를 찾습니다. |
sort | string | 선택 사항. 결과 정렬합니다. 하향 정렬하려면 - 접두사를 사용합니다. 허용 필드: created_at , title , duration_in_seconds . 기본값: -created_at . |
per_page | integer | 선택 사항. 페이지당 결과 수를 지정합니다. 기본값: 15 , 최대: 100 . |
필터링 예제
filters
매개변수는 가장 강력한 기능입니다. 문법은 filters[field_name][operator]=value
입니다.
컬렉션 경로 필터링
이것은 모든 비디오를 찾습니다. education/php
폴더 내부에 있습니다.
GET /api/client/v1/videos?path=root/education/php
단일 메타데이터 필드 필터링 (같음)
이것은 모든 비디오를 찾습니다. genre
가 ‘Action’ 인 경우, 대소문자 구분없이.
GET /api/client/v1/videos?filters[genre]=Action
경로 및 메타데이터 필터링
이것은 모든 ‘초보자’ 비디오를 찾습니다. fitness/yoga
컬렉션 내부에 있습니다.
GET /api/client/v1/videos?path=root/fitness/yoga&filters[difficulty]=beginner
”보다 크다” (gt
) 필터링
이것은 모든 비디오를 찾습니다. 길이가 10분 (600초) 이상입니다.
GET /api/client/v1/videos?filters[duration_in_seconds][gt]=600
”보다 작거나 같음” (lte
) 필터링
이것은 모든 비디오를 찾습니다. 등급이 3점 이하입니다.
GET /api/client/v1/videos?filters[rating][lte]=3
”목록 내” (in
) 필터링
이것은 모든 비디오를 찾습니다. 난이도가 ‘초보자’ 또는 ‘중급’ 인 경우.
GET /api/client/v1/videos?filters[difficulty][in]=beginner,intermediate
”같지 않음” (neq
) 필터링
이것은 모든 비디오를 찾습니다. 발표자가 ‘Jane Doe’가 아닌 경우.
GET /api/client/v1/videos?filters[presenter][neq]=Jane Doe
정렬 및 태그 예제
태그 필터링
이것은 모든 비디오를 찾습니다. BOTH ‘요가’ AND ‘초보자’ 태그가 있는 경우.
GET /api/client/v1/videos?tags=yoga,beginner
제목 정렬 (오름차순)
이것은 모든 비디오를 찾습니다. 제목으로 오름차순 정렬합니다.
GET /api/client/v1/videos?sort=title
날짜 정렬 (내림차순)
이것은 모든 비디오를 찾습니다. 가장 최근에 업데이트된 순으로 정렬합니다. 기본 동작이며 sort
매개변수 제공 시 동일합니다.
GET /api/client/v1/videos?sort=-created_at
전체 응답: GET /videos
이것은 페이지당 비디오 목록의 완전한 예입니다.
{
"data": [
{
"id": "9c1a9e3e-6c9b-4f8a-8e2d-9b3c1d4e0f6a",
"title": "고급 API 디자인 Laravel",
"description": "강력한 API를 구축하는 데 대한 깊은 이해입니다.",
"duration_in_seconds": 3620,
"created_at": "2024-08-10T12:00:00Z",
"metadata": {
"difficulty": "advanced",
"presenter": "Jane Doe"
}
},
{
"id": "9c1a9e3e-7d8c-5g9b-9f1c-8a2b0c3d9e8f",
"title": "요가 소개",
"description": "기본 요가 자세에 대한 초급자 가이드입니다.",
"duration_in_seconds": 1800,
"created_at": "2024-08-09T10:00:00Z",
"metadata": {
"difficulty": "beginner",
"presenter": "John Smith"
}
}
],
"links": {
"first": "https://your-app.com/api/client/v1/videos?page=1",
"last": "https://your-app.com/api/client/v1/videos?page=5",
"prev": null,
"next": "https://your-app.com/api/client/v1/videos?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 5,
"links": [
{
"url": null,
"label": "« 이전",
"active": false
},
{
"url": "https://your-app.com/api/client/v1/videos?page=1",
"label": "1",
"active": true
},
{
"url": "https://your-app.com/api/client/v1/videos?page=2",
"label": "2",
"active": false
},
{
"url": "https://your-app.com/api/client/v1/videos?page=3",
"label": "3",
"active": false
},
{
"url": "https://your-app.com/api/client/v1/videos?page=4",
"label": "4",
"active": false
},
{
"url": "https://your-app.com/api/client/v1/videos?page=5",
"label": "5",
"active": false
},
{
"url": "https://your-app.com/api/client/v1/videos?page=2",
"label": "다음 »",
"active": true
}
],
"path": "https://your-app.com/api/client/v1/videos",
"per_page": 2,
"to": 2,
"total": 10
}
}
단일 비디오 가져오기
단일 비디오의 전체 데이터를 가져옵니다. 플레이어에 적합합니다. 응답은 단일 비디오 객체입니다.
GET /videos/{videoId}
경로 매개변수
이름 | 타입 | 설명 |
---|---|---|
videoId | uuid | 필수. 비디오의 고유 식별자입니다. |
예제 요청
GET /api/client/v1/videos/9c1a9e3e-6c9b-4f8a-8e2d-9b3c1d4e0f6a
전체 응답: GET /videos/{videoId}
{
"data": {
"id": "9c1a9e3e-6c9b-4f8a-8e2d-9b3c1d4e0f6a",
"title": "고급 API 디자인 Laravel",
"description": "강력한 API를 구축하는 데 대한 깊은 이해입니다.",
"duration_in_seconds": 3620,
"created_at": "2024-08-10T12:00:00Z",
"manifest": {
"hls_url": "https://your-cdn.com/path/to/master.m3u8",
"dash_url": "https://your-cdn.com/path/to/manifest.mpd"
},
"captions": [
{
"label": "영어",
"language": "en",
"is_default": true,
"url": "https://your-cdn.com/path/to/en.vtt"
},
{
"label": "스페인어",
"language": "es",
"is_default": false,
"url": "https://your-cdn.com/path/to/es.vtt"
}
],
"transcript": {
"type": "vtt",
"url": "https://your-cdn.com/path/to/transcript.vtt"
},
"thumbnails": [
{ "url": "https://your-cdn.com/path/to/thumb1.jpg" },
{ "url": "https://your-cdn.com/path/to/thumb2.jpg" }
],
"tags": ["laravel", "api", "php"],
"metadata": {
"difficulty": "advanced",
"presenter": "Jane Doe",
"related_course": "API Mastery",
"language": "en-US"
}
}
}