Skip to content

Publishing a course

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

Publishing course by the instructor

Returns json with course details

URL: /api/instructor/course/:courseId/publish

Method: PUT

Authorization required: Yes

Success Response

Condition: when instructor publishes course

Code : 200 Ok

Example:

{
    "ID": 4,
    "CreatedAt": "2022-02-23T16:49:27.533489286-05:00",
    "UpdatedAt": "2022-03-31T16:01:59.905525188-04:00",
    "DeletedAt": null,
    "title": "Neural",
    "description": null,
    "isPublished": true,
    "publishedAt": null,
    "instructorId": 3,
    "modules": null
}

Error Responses

Condition: If the input request url has course which has not created.

Code: 404 not found

Example:

{
    "error": "course not found"
}

Condition: If the course is already published.

Code: 400 Bad Request

Example:

{
    "error": "course already published"
}

Condition: If the instructor and course does not match.

Code: 401 Unauthorized

Example:

{
    "error": "Unauthorised access for this course"
}

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: Unknown error.

Code: 500 Internal Server Error

Example:

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