Skip to Content

ビデオ API

ビデオ APIは、動画コンテンツを取得するための主なエンドポイントです。強力なフィルタリング、ソーティング、およびタグ付け機能をサポートしています。

ビデオの一覧

指定されたページのビデオの一覧を取得します。このエンドポイントは非常に柔軟で、結果を絞り込むためにいくつかのクエリパラメーターを受け取ります。レスポンスには、ビデオサマリー オブジェクトの配列が含まれます。

GET /videos

クエリ パラメーター

名前タイプ説明
pathstringオプション。 指定されたコレクションパスにフィルタリングします (例: root/movies)。
filtersobjectオプション。 メタデータでフィルタリングします。フィルタリングの例を参照してください。
tagsstringオプション。 カンマ区切りで指定されたタグでフィルタリングします (例: laravel,api)。すべての指定されたタグを持つビデオを検索します。
sortstringオプション。 結果をソートします。降順にソートするには - を先頭に付けます。許可されているフィールド: created_attitleduration_in_seconds。デフォルト: -created_at
per_pageintegerオプション。 ページあたりの結果数を指定します。デフォルト: 15、最大値: 100

フィルタリングの例

filters パラメーターは最も強力な機能です。シンタックスは filters[field_name][operator]=value です。

コレクション パスでフィルタリング

この指定されたコレクション内のすべてのビデオを検索します。

GET /api/client/v1/videos?path=root/education/php

単一のメタデータ フィールド (等値) でフィルタリング

この指定された genre のビデオを検索します。ケースは無視されます。

GET /api/client/v1/videos?filters[genre]=Action

パスとメタデータでフィルタリング

この指定された difficulty のビデオを検索します。コレクションは fitness/yoga です。

GET /api/client/v1/videos?path=root/fitness/yoga&filters[difficulty]=beginner

“大きい方” (gt) でフィルタリング

この指定された時間以上のビデオを検索します (600 秒)。

GET /api/client/v1/videos?filters[duration_in_seconds][gt]=600

“小さい方または等しい” (lte) でフィルタリング

この指定されたスコア以下のビデオを検索します。

GET /api/client/v1/videos?filters[rating][lte]=3

“リスト内に含まれる” (in) でフィルタリング

この指定された difficulty のビデオを検索します。コレクションは beginner または intermediate です。

GET /api/client/v1/videos?filters[difficulty][in]=beginner,intermediate

“等しくない” (neq) でフィルタリング

この指定されたプレゼンターのビデオを検索します。

GET /api/client/v1/videos?filters[presenter][neq]=Jane Doe

ソーティングとタグ付けの例

タグでフィルタリング

この指定された yogabeginner のビデオを検索します。

GET /api/client/v1/videos?tags=yoga,beginner

タイトル (昇順) でソーティング

この指定されたタイトルのビデオを昇順にソーティングします。

GET /api/client/v1/videos?sort=title

日付 (降順) でソーティング

この指定された日付のビデオを降順にソーティングします。この指定は省略可能です。デフォルトでは、最新のビデオが先頭になります。

GET /api/client/v1/videos?sort=-created_at

フル レスポンス: GET /videos

この指定されたページの完全な、省略されていない例です。

Response: 200 OK
{ "data": [ { "id": "9c1a9e3e-6c9b-4f8a-8e2d-9b3c1d4e0f6a", "title": "Advanced API Design in Laravel", "description": "A deep dive into building robust APIs.", "duration_in_seconds": 3620, "thumbnail_url": "https://your-cdn.com/path/to/thumb1.jpg", "created_at": "2024-08-10T12:00:00Z", "metadata": { "difficulty": "advanced", "presenter": "Jane Doe" } }, { "id": "9c1a9e3e-7d8c-5g9b-9f1c-8a2b0c3d9e8f", "title": "Introduction to Yoga", "description": "A beginner's guide to basic yoga poses.", "duration_in_seconds": 1800, "thumbnail_url": "https://your-cdn.com/path/to/thumb2.jpg", "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": "« Previous", "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": "Next »", "active": true } ], "path": "https://your-app.com/api/client/v1/videos", "per_page": 2, "to": 2, "total": 10 } }

ビデオを取得する

指定されたビデオの詳細なデータを取得します。このレスポンスは、プレイヤーに適した形式です。レスポンスは単一の ビデオ オブジェクトです。

GET /videos/{videoId}

パス パラメーター

名前タイプ説明
videoIduuid必須。 ビデオのユニーク識別子です。

例要求

GET /api/client/v1/videos/9c1a9e3e-6c9b-4f8a-8e2d-9b3c1d4e0f6a

フル レスポンス: GET /videos/{videoId}

Response: 200 OK
{ "data": { "id": "9c1a9e3e-6c9b-4f8a-8e2d-9b3c1d4e0f6a", "title": "Advanced API Design in Laravel", "description": "A deep dive into building robust APIs.", "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": "English", "language": "en", "is_default": true, "url": "https://your-cdn.com/path/to/en.vtt" }, { "label": "Español", "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" } } }