Skip to content

Add video module to the course

Gauri Pandharinath Bodke edited this page Jun 15, 2022 · 1 revision

Add a video module to the course

Add a video module to the course if the course belongs to the logged-in instructor.

URL: /api/instructor/course/:courseId/module/video

URL Parameters : courseId=[integer] where courseId is the ID of the course to which module needs to be added.

Method: POST

Authorization required: Yes

Content-Type: multipart/form-data

Data constraints:

title: String with a minimum length of 1
file: video file
isPrivate: "true"/"false"

Example:

title: "My first video"
file: @~/videoFile.mkv
isPrivate: "true"

Success Response

Condition: If everything goes well and the video module is created.

Code : 201 Created

Example:

{
    "ID": 1,
    "CreatedAt": "2022-03-29T17:01:54.029282868-04:00",
    "UpdatedAt": "2022-03-29T17:01:54.029282868-04:00",
    "DeletedAt": null,
    "title": "My first video module",
    "type": "video",
    "isPrivate": true,
    "courseId": 1,
    "video": {
        "ID": 1,
        "CreatedAt": "2022-03-29T17:01:54.035578763-04:00",
        "UpdatedAt": "2022-03-29T17:01:54.035578763-04:00",
        "DeletedAt": null,
        "key": "[email protected]/1/20220329170151_correctFile.mkv",
        "moduleId": 1
    },
    "quiz": {
        "ID": 0,
        "CreatedAt": "0001-01-01T00:00:00Z",
        "UpdatedAt": "0001-01-01T00:00:00Z",
        "DeletedAt": null,
        "moduleId": 0,
        "numOfQuestions": 0,
        "Questions": null
    }
}

Error Responses

Condition: If the input request does not satisfy data constraints.

Code: 400 Bad Request

Example:

{
    "error": "incorrect parameters"
}

Condition: If the JWT-token is not present in the request headers.

Code: 401 Unauthorized

Example:

{
    "error": "token not found"
}

Condition: If the JWT-token is expired.

Code: 401 Unauthorized

Example:

{
    "error": "user unauthorized"
}

Condition: If the file format is incorrect.

Code: 400 Bad Request

Example:

{
    "error": "incorrect file format"
}

Condition: If the course Id does not exist or does not belong to the logged-in instructor.

Code: 404 Bad Request

Example:

{
    "error": "course not found"
}

Condition: Unknown error.

Code: 500 Internal Server Error

Example:

{
    "error": "internal server error"
}
Clone this wiki locally