0% found this document useful (0 votes)
9 views2 pages

University Course Management API Documentation

This document outlines the design of a RESTful API for a University Course Management System, detailing its objectives, system overview, resources, and endpoint design. It includes information on HTTP status codes, request/response examples, best practices, authentication methods, and versioning. The API is documented using OpenAPI 3.0 and adheres to REST principles for managing students, courses, instructors, and enrollments.

Uploaded by

thangpq5002
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

University Course Management API Documentation

This document outlines the design of a RESTful API for a University Course Management System, detailing its objectives, system overview, resources, and endpoint design. It includes information on HTTP status codes, request/response examples, best practices, authentication methods, and versioning. The API is documented using OpenAPI 3.0 and adheres to REST principles for managing students, courses, instructors, and enrollments.

Uploaded by

thangpq5002
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

REST API Design Assignment

University Course Management System

1. Objective
This document describes the design of a RESTful API for a University Course Management
System. The purpose is to demonstrate understanding of REST principles, endpoint design,
versioning, best practices, authentication, and OpenAPI documentation. This is a
documentation-only assignment.

2. System Overview
The API allows a university to manage students, courses, instructors, and enrollments. All
endpoints follow RESTful conventions and use JSON as the data format.

3. Resources
- Students: id, name, email, major, enrolledCourses
- Courses: id, code, title, description, credits, instructor
- Instructors: id, name, email, department
- Enrollments: id, studentId, courseId, enrollmentDate, grade

4. API Endpoint Design (Version 1)


 GET /api/v1/students – List all students
 GET /api/v1/students/{id} – Get student by ID
 POST /api/v1/students – Create a new student
 PUT /api/v1/students/{id} – Update student
 DELETE /api/v1/students/{id} – Delete student
 GET /api/v1/courses – List all courses
 GET /api/v1/courses/{id} – Get course by ID
 POST /api/v1/courses – Create course
 PUT /api/v1/courses/{id} – Update course
 POST /api/v1/enrollments – Enroll student
 GET /api/v1/students/{id}/enrollments – Get enrollments
 DELETE /api/v1/enrollments/{id} – Drop enrollment

5. HTTP Status Codes Usage


200 OK – Successful GET, PUT, PATCH requests
201 Created – Resource created successfully
400 Bad Request – Invalid request syntax
404 Not Found – Resource does not exist
422 Validation Error – Input data validation failed

6. Request and Response Examples


Create Student – POST /api/v1/students
{
"name": "Alice Nguyen",
"email": "alice@[Link]",
"major": "Computer Science"
}

201 Created Response

{
"id": 1,
"name": "Alice Nguyen",
"email": "alice@[Link]",
"major": "Computer Science"
}

7. API Best Practices


Pagination: GET /students?page=1&limit=20
Filtering: GET /courses?instructor=[Link]
Sorting: GET /courses?sort=credits:desc
Consistent error response format is used for all errors.

8. Authentication & Authorization


Authentication is handled using JWT Bearer tokens.
Roles:
- Admin: Full access
- Instructor: Manage courses and grades
- Student: View courses and enroll
Login endpoint: POST /api/v1/auth/login

9. API Versioning (v1 to v2)


The API uses URL-based versioning.
Breaking Change in v2: student field "email" is renamed to "primaryEmail".
Reason: Support multiple email addresses.
Migration: Clients must update field usage.
v1 will be deprecated after 12 months.

10. Swagger / OpenAPI


The API is documented using OpenAPI 3.0 and Swagger Editor.
Schemas are defined for Student, Course, Enrollment, and Error.
Bearer authentication is included in the security scheme.

You might also like