5. Media API
5.1 — Media Object Model
Variable | Type | Description |
---|---|---|
login_id / loginid | string | Login ID for the user. |
group_id | string | Unique group ID generated by the system. |
title | string | Title of the uploaded video or the folder to be created. |
file_key | string | Key returned by the system to upload a file. |
description | string | Description of the uploaded video. |
video_id / videonode_id / videoPID | string | Unique video ID generated by the system. |
folder_id / folderID / nodePID | string | Unique folder PID generated by the system. |
video_id / VideoPID | integer | Video ID of the selected video. |
file_key | integer | Key obtained from the JSON response (see Section 5.2.44). |
Note: Some fields appear in multiple forms (e.g.,
video_id
vs.VideoPID
) to reflect different API responses and request usages.
5.2 — Main Endpoints
All paths are relative to the base: https://{organization_subdomain}.yuja.com/services
.
Method | Path | Description |
---|---|---|
GET | /media/createuploadlink | Retrieves an upload link and file_key to upload a media file. |
POST | /media/upload/video | Uploads video details. |
POST | /media/publish/video | Publishes a video in a course. |
GET | /media/video/group/{group_id} | Retrieves videos published in a course. |
GET | /media/video/directlink/{video_id} | Retrieves direct link and embed code for a video. |
5.2.1 — GET /media/createuploadlink
Returns a JSON object with the upload link and file_key
.
To upload the video to S3, make an HTTP PUT request to the returned url
and include the video file as the request body.
Example URL
https://api-testing.yuja.com/services/media/createuploadlink
Parameters
No parameters.
Example Response
[
{
"url": "<upload_link>",
"key": "<key>"
}
]
5.2.2 — POST /media/upload/video/
Uploads a video to the media library of the user whose login_id
matches the body parameter.
Example URL
https://api-testing.yuja.com/services/media/upload/video/
Body Parameters
Name | Type | Required | Description |
---|---|---|---|
login_id | string | Yes | User login ID. |
title | string | Yes | Video title. |
file_key | string | Yes | Must match the key returned by GET /media/createuploadlink . |
description | string | No | Video description. |
Example JSON Data
This endpoint expects JSON data of this format in the body parameter:
{
"login_id": "instructor_123",
"title": "Week 1 — Course Overview",
"file_key": "3f6c2b1a9d8e4f07b6c5a4e3d2c1b0aa"
}
Example Response
[
{
"status": "Uploaded",
"video_id": "67890"
}
]
5.2.3 — POST /media/publish/video
Publishes a video owned by login_id
to a class/group.
Example URL
https://api-testing.yuja.com/services/media/publish/video
Body Parameters
Name | Type | Required | Description |
---|---|---|---|
login_id | string | Yes | Owner’s login ID. |
class_id | string | Yes | Target class/group ID (sometimes referred to as group_id ). |
video_id | string | Yes | The video to publish. |
Example JSON Data
This endpoint expects JSON data of this format in the body parameter:
{
"login_id": "instructor_123",
"title": "Week 1 — Course Overview",
"file_key": "3f6c2b1a9d8e4f07b6c5a4e3d2c1b0aa"
}
Example Response
[
{
"status": "published",
"video_id": "67890",
"class_id": "121"
}
]
5.2.4 — GET /media/video/group/{group_id}
Retrieves video details for the specified class/group.
Example URL
https://api-testing.yuja.com/services/media/video/group/121
Path Parameters
Name | Type | Description |
---|---|---|
group_id | string | Should match a group_id from the Groups API. |
Example Response
[
{
"description": "uploaded by abcd",
"title": "avi_test1",
"video_id": "67890"
},
{
"description": "uploaded by pqrs",
"title": "flv_test1",
"video_id": "67891"
}
]
5.2.5 — GET /media/video/directlink/{video_id}
Returns a JSON object containing the direct link and embed code for a video.
Example URL
https://api-testing.yuja.com/services/media/video/directlink/67890
Path Parameters
Name | Type | Description |
---|---|---|
video_id | string | Should match a video_id returned by GET /media/video/group/{group_id} . |
Example Response
{
"directlink": "<Direct link to the video>",
"embedcode": "<Embed code for the video>"
}