Videos
This guide explains how to interact with the Videos API in the Sumaya369 web application. The API provides endpoints for tracking watched videos and managing video notes, including features for creating, updating, and retrieving video-related data.
Watched Videos
Store Watched Video
Record a video as watched for the authenticated user. This endpoint helps track user progress through video content.
Endpoint
- Method: POST
- URL:
/v1/mobile/watched-videos
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer token | Yes |
Request Body Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| video_id | string | UUID of the video to mark as watched | Yes |
| stopped | float | Current video timer | Yes |
Success Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "36a7cdf0-ffda-11ef-bbc2-992118d4adec",
"stopped_in": 649
},
"status_code": 200
}
Video Notes
List Notes
Retrieve all notes for a specific video.
Endpoint
- Method: GET
- URL:
/v1/mobile/videos/{video_id}/notes
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| video_id | string | Video UUID | Yes |
Success Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"current_page": 1,
"first_page_url": "http://127.0.0.1:8000/v1/mobile/videos/c03d6710-f610-11ec-aaf7-f380290ea2d7/notes?timestamp=0%3A00&page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://127.0.0.1:8000/v1/mobile/videos/c03d6710-f610-11ec-aaf7-f380290ea2d7/notes?timestamp=0%3A00&page=1",
"links": [
{
"url": null,
"label": "« السابق",
"active": false
},
{
"url": "http://127.0.0.1:8000/v1/mobile/videos/c03d6710-f610-11ec-aaf7-f380290ea2d7/notes?timestamp=0%3A00&page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "التالي »",
"active": false
}
],
"next_page_url": null,
"path": "http://127.0.0.1:8000/v1/mobile/videos/c03d6710-f610-11ec-aaf7-f380290ea2d7/notes",
"per_page": 10,
"prev_page_url": null,
"to": 1,
"total": 1,
"notes": [
{
"id": "4f97f6a0-ffda-11ef-b13e-351fb02fcbfb",
"date": "2025-03-13",
"note": "wow so good2"
}
]
},
"status_code": 200
}
Create Note
Create a new note for a specific video.
Endpoint
- Method: POST
- URL:
/v1/mobile/notes
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer token | Yes |
Request Body Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| video_id | string | UUID of the video to add note to | Yes |
| note | string | Content of the note | Yes |
Success Response
{
"success": true,
"message": "تم حفظ البيانات بنجاح.",
"data": {
"id": "4f97f6a0-ffda-11ef-b13e-351fb02fcbfb",
"date": "2025-03-13",
"note": "wow so good"
},
"status_code": 200
}
Update Note
Update an existing note.
Endpoint
- Method: PUT
- URL:
/v1/mobile/notes/{id}
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| id | string | Note UUID | Yes |
Request Body Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| note | string | Updated content of the note | Yes |
Success Response
{
"success": true,
"message": "تم تحديث البيانات بنجاح.",
"data": {
"id": "4f97f6a0-ffda-11ef-b13e-351fb02fcbfb",
"timestamp": "12:21",
"note": "wow so good2"
},
"status_code": 200
}
Delete Note
Delete an existing note.
Endpoint
- Method: DELETE
- URL:
/v1/mobile/notes
Path Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| ids | array | Array of Note UUID | Yes |
Success Response
{
"success": true,
"message": "تم حذف البيانات بنجاح.",
"data": null,
"status_code": 200
}
Example Implementation Flow
-
Video Watching
- User starts watching a video
- Application periodically sends watched time updates
- Server records progress using the store watched video endpoint
-
Note Management
- User can view all notes for a video
- Create new notes while watching
- Update or delete existing notes
- Notes are associated with specific video timestamps
Key Considerations
- Authentication is required for all endpoints
- Video progress is tracked in real-time
- Notes are personal to each user
- Only videos from active subscriptions can be tracked
- System only updates progress if new timestamp is greater than existing
- Promotional videos are not counted towards course completion
- Course completion triggers questionnaire email to user