Live API: http://llmss.150.230.237.119.sslip.io/
- URL:
/api/register
- Method:
POST
- Description: Registers a new user.
- Sample Input:
{ "full_name": "John Doe", "email": "john.doe@example.com", "passwd": "password123" }
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/login
- Method:
POST
- Description: Logs in a user.
- Sample Input:
{ "email": "john.doe@example.com", "passwd": "password123" }
- Sample Output:
{ "message": "SUCCESS", "token": "jwt_token" }
- URL:
/api/files/:id
- Method:
GET
- Description: Retrieves a file by ID.
- Sample Output:
*Send the file as attachment (byte stream)*
- URL:
/api/courses
- Method:
GET
- Description: Retrieves a list of courses.
- Sample Output:
{"message": "SUCCESS", "courses": [ { "id": "1", "title": "Course 1", "description": "Description of Course 1", "thumbnail_id": "1", "created_at": "2021-01-01T00:00:00.000Z" }, { "id": "2", "title": "Course 2", "description": "Description of Course 2", "thumbnail_id": "2", "created_at": "2021-01-02T00:00:00.000Z" } ]}
- URL:
/api/courses/:id
- Method:
GET
- Description: Retrieves full details of a course by ID.
- Sample Output:
{ "message": "SUCCESS", "id": "1", "title": "Course 1", "description": "Description of Course 1", "thumbnail_id": "1", "created_at": "2021-01-01T00:00:00.000Z", "contents": [ { "id": "1", "text": "Content 1", "description": "Description of Content 1" } ] }
- URL:
/api/profile
- Method:
GET
- Description: Retrieves the authenticated user's profile.
- Sample Output:
{ "message": "SUCCESS", "id": "1", "full_name": "John Doe", "role": "user", "email": "x@x.com" }
- URL:
/api/enrollments
- Method:
POST
- Description: Enrolls a user in a course.
- Sample Input:
{ "course_id": "1" }
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/enrollments
- Method:
GET
- Description: Retrieves a list of enrollments for the authenticated user.
- Sample Output:
{ "message": "SUCCESS", "course_ids": ["1", "2"] }
- URL:
/api/enrollments/:course_id
- Method:
DELETE
- Description: Removes a user from a course.
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/progress
- Method:
POST
- Description: Marks content as completed.
- Sample Input:
{ "content_id": "1" }
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/progress
- Method:
DELETE
- Description: Marks content as incomplete.
- Sample Input:
{ "content_id": "1" }
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/progress/:course_id
- Method:
GET
- Description: Retrieves progress for a course.
- Sample Output:
{ "message": "SUCCESS", "progress": [ { "content_id": "1", "completed": true }, { "content_id": "2", "completed": false } ] }
- URL:
/api/admin/users
- Method:
GET
- Description: Retrieves a list of users.
- Sample Output:
[ { "id": "1", "full_name": "John Doe", "role": "user", "email": "john.doe@example.com", "created_at": "2021-01-01T00:00:00.000Z" } ]
- URL:
/api/admin/files
- Method:
POST
- Description: Uploads a new file.
- Sample Input:
*Send the file as form-data*
- Sample Output:
{ "message": "SUCCESS", "file_id": "1" }
- URL:
/api/admin/files/:id
- Method:
DELETE
- Description: Deletes a file by ID.
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/admin/trash-files
- Method:
GET
- Description: Finds unused files.
- Sample Output:
{ "message": "SUCCESS", "files": [ { "id": "1", "file_path": "path/to/file", "created_at": "2021-01-01T00:00:00.000Z" } ] }
- URL:
/api/admin/courses
- Method:
POST
- Description: Creates a new course.
- Sample Input:
{ "title": "New Course", "description": "Description of the new course", "thumbnail_id": "1" }
- Sample Output:
{ "message": "SUCCESS", "id": "1" }
- URL:
/api/admin/courses/:id
- Method:
PUT
- Description: Updates a course by ID.
- Sample Input:
{ "title": "Updated Title or Old Title", "description": "Updated description or old description", "thumbnail_id": "new_thumbnail_id or old_thumbnail_id" }
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/admin/courses/:id
- Method:
DELETE
- Description: Deletes a course by ID.
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/admin/contents
- Method:
POST
- Description: Creates new content.
- Sample Input:
{ "course_id": "1", "text": "Title of the new content", "description": "Description of the new content", "file_id": "1" }
- Sample Output:
{ "message": "SUCCESS", "id": "1" }
- URL:
/api/admin/contents/:id
- Method:
PUT
- Description: Updates content by ID.
- Sample Input:
{ "text": "New title or old title", "description": "Updated description or old description", "file_id": "1" }
- Sample Output:
{ "message": "SUCCESS" }
- URL:
/api/admin/contents/:id
- Method:
DELETE
- Description: Deletes content by ID.
- Sample Output:
{ "message": "SUCCESS" }