Upload Content
XYZ Corp, is a global conglomerate with over ten thousand employees, spread across 7 locations. Employee training and enablement is one of the core values of the organization. Before the organization opted to use the Sunbird platform, employees accessed another legacy system that to train and upskill themselves. The legacy system has a large repository of content artifacts. These artifacts have to be uploaded into Sunbird so that employees can access them, even through Sunbird. The organization also creates content artifacts and courses using multiple resources on an ongoing basis. Content and course creators also need to upload all such new content into Sunbird.
Prerequisites
An intialized Sunbird instance with channel
The API Key for access and basic authentication
Software that can make API calls like curl or POSTMAN
Content creation access
Content artifacts with a unique object ID
Intended Audience
Content Creator: Users who have permissions to create, manage, and upload content artifacts
Content Reviewer: Users who have permissions to review and publish content artifacts
Note: Reviewers cannot change any content. They can only send review comments to content creators for modifications or publish the content artifact directly, if no modifications are required.
Overview
Sunbird allows you to assign users with roles that have appropriate permissions to create, store, upload or consume content. Users with content creation rights can create and upload content on Sunbird.
Currently, the Sunbird platform supports the following content formats:
Text (.pdf)
Audio (.mp3)
Images (.jpeg, .png)
Video (.mp4, .webm, YouTube URLs)
HTML
ECML (created using the inbuilt content editor)
EPUB
H5P
Note: Currently, you can upload files with a maximum file size of 50MB per file. More file formats will be supported in future versions of Sunbird.
Sunbird validates every content artifact that is uploaded using metadata. Hence, it is mandatory to tag each file with the following metadata before it is uploaded:
Content Type
Mime Type
You can upload video content owned by others, if:
you have the required permissions from the original creator
it adheres to prescribed content guidelines
it is in the accepted file format
it is within the prescribed size limit
Taskflow
To upload new or existing content (that is not created using Sunbird’s inbuilt content editor) on to Sunbird, use the Upload Content API. Before you upload the content, ensure that it is appropriately tagged with metadata and ownership information.
Uploading Content Using API
This API is associated with uploading content on the Sunbird Platform.
The _/upload/{content_ID} endpoint executes the Upload Content request based on validated content metadata associated with the uploaded file
Specify a valid value in the {Content Id} field of API URL
Specify values for all the mandatory form data parameters
Path Parameters:
Form Data Parameters:
Header Parameter
Request Body
key
: file value
: file path (Ex: /Users/john/Documents/test.pdf)
Note: Below is the sample cURL of the complete request.
Response Body (Upload Content API)
For the youtube content or file url, pass it as file Url in Upload API or set the artifact Url of the content using Update Content API**
After uploading the content, publish the content using **Publish Content API**.
Request Body (Publish Content API)
Response Body (Publish Content API)
Note: Reviewer has the right to publish content. Use the ID of any approved reviewer as the publisher user ID.
Response Code:
200 SUCCESS: The upload content operation is successful!
400 ‘BAD REQUEST: The upload content operation failed. It indicates you may have missed input for some mandatory parameter.
500 ‘INTERNAL SERVER ERROR: We track these errors automatically and try to set it right at the earliest. Try refreshing the page. If the problem stil persists, contact us at info@sunbird.org.
Last updated