Moodle
Overview
In this assignment, you will design the API for your project using a structured, AI-assisted workflow.
You will move from:
data model → endpoints → requests/responses → validation → workflow
This builds directly on your previous work:
- project idea
- user stories
- MVP definition
- data model
Learning Objectives
By completing this assignment, you will be able to:
- Translate a data model into a working API design
- Define clear and consistent REST endpoints
- Design request and response structures
- Incorporate validation and business logic into an API
- Use AI to assist (but not replace) system design
- Critically evaluate and refine AI-generated API designs
Deliverables
1. Endpoint List (Required)
List all API endpoints for your system.
For each endpoint include:
- HTTP method (GET, POST, PUT, DELETE)
- path (e.g., /events, /events/:id)
- brief description
2. Request & Response Design (Required)
For each endpoint, provide:
- Example request JSON (if applicable)
- Example response JSON
Example:
POST /events
Request:
{
"title": "AI Workshop",
"date_time": "2026-04-01",
"location": "Kenyon College"
}
Response:
{
"id": 12,
"status": "pending"
}
3. Validation Rules (Required)
For each endpoint, describe validation rules:
- required fields
- data format constraints
- error conditions
4. Workflow / Business Logic (Required)
Describe how your system behaves beyond CRUD:
- status fields (e.g., pending, approved, rejected)
- special actions (e.g., approve event)
- state transitions
This can be a short write-up or bullet list.
5. Permissions (Required)
For each endpoint, specify:
- who can access it (user, admin, etc.)
- any restrictions
6. Design Explanation (Required)
Short write-up (1–2 pages) explaining:
- how your API supports your user stories
- how it maps to your data model
- what you simplified for MVP
- any tradeoffs you made
7. AI Prompt Log (Required)
Include the prompts you used, such as:
- endpoint generation prompt
- request/response design prompt
- critique/refinement prompts
For each:
- include the prompt
- briefly explain how you used the output
Required Process (Very Important)
Step 1 — Start from Your Data Model
Use your schema from the previous assignment.
- Identify core resources (tables → endpoints)
Step 2 — Generate Initial API (with AI)
Use a structured prompt like:
Using my database schema, design a REST API for a React/Node/MariaDB application. Please: - define endpoints for MVP only - include CRUD operations - include any workflow actions (e.g., approval) - provide example request/response JSON - keep the design simple and consistent
Step 3 — Critique the API (with AI)
Review this API design and: - identify missing endpoints - identify inconsistencies - suggest simplifications - ensure it supports all user stories - flag anything too complex for a 7-week project
Step 4 — Refine Manually
You must:
- simplify endpoints
- ensure consistent naming
- verify against user stories
- remove unnecessary features
Constraints (Read Carefully)
Your API must:
- be implementable in 7 weeks
- support your MVP only
- be consistent in structure
- avoid unnecessary endpoints
Common Mistakes to Avoid
Do NOT:
- blindly copy AI output
- design endpoints after coding
- use inconsistent naming
- skip request/response design
- ignore validation
- forget workflow/status logic
Example (Reference Only)
For a campus event planner, a reasonable API might include:
- GET /events
- POST /events
- GET /events/:id
- PUT /events/:id
- DELETE /events/:id
- POST /events/:id/approve
NOT:
- notifications
- messaging
- analytics
(unless explicitly required)
Grading Criteria
| Category | Points |
|---|---|
| Endpoints & structure | 25 |
| Request/response design | 20 |
| Validation & logic | 15 |
| Alignment with data model | 15 |
| Simplicity / appropriate scope | 10 |
| Design explanation | 10 |
| AI prompt usage & reflection | 5 |
Timeline
Draft Due: April X
Submit:
- endpoint list
- sample request/response
- basic workflow ideas
- AI prompts used so far
Final Due: April X
Submit:
- complete API design
- refined request/response examples
- validation rules
- permissions
- final explanation
- revised prompts + reflections
Final Advice
A good API makes your app easy to build.
A bad API makes everything harder.
And most importantly:
Do not let AI design your API.
Use AI to help you design it better.
