Skip to main content

5. Media API

5.1 — Media Object Model

VariableTypeDescription
login_id / loginidstringLogin ID for the user.
group_idstringUnique group ID generated by the system.
titlestringTitle of the uploaded video or the folder to be created.
file_keystringKey returned by the system to upload a file.
descriptionstringDescription of the uploaded video.
video_id / videonode_id / videoPIDstringUnique video ID generated by the system.
folder_id / folderID / nodePIDstringUnique folder PID generated by the system.
video_id / VideoPIDintegerVideo ID of the selected video.
file_keyintegerKey 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.

MethodPathDescription
GET/media/createuploadlinkRetrieves an upload link and file_key to upload a media file.
POST/media/upload/videoUploads video details.
POST/media/publish/videoPublishes 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.

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

NameTypeRequiredDescription
login_idstringYesUser login ID.
titlestringYesVideo title.
file_keystringYesMust match the key returned by GET /media/createuploadlink.
descriptionstringNoVideo 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

NameTypeRequiredDescription
login_idstringYesOwner’s login ID.
class_idstringYesTarget class/group ID (sometimes referred to as group_id).
video_idstringYesThe 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

NameTypeDescription
group_idstringShould 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

NameTypeDescription
video_idstringShould 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>"
}

View the guide on YuJa Support