API Reference¶
This section documents the API endpoints available in the PhonoLab backend.
Lesson API¶
Front-End¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /lesson/ |
Get all lessons |
| GET | /lesson/<lesson_id> |
Get a lesson by ID |
| GET | /lesson/vowel/<vowel_id> |
Get a lesson by vowel ID |
| GET | /quiz/ |
Get all quiz items |
| GET | /quiz/<quiz_id> |
Get a quiz item by ID |
| GET | /quiz/vowel/<vowel_id> |
Get all quiz items for a specific vowel |
lesson
¶
create_all_lessons
¶
Create lessons for all vowels that don't have lessons yet.
Source code in src/api/lesson.py
create_new_lesson
¶
Create a new lesson.
Source code in src/api/lesson.py
delete_existing_lesson
¶
Delete a lesson.
Source code in src/api/lesson.py
fetch_all_lessons
¶
Get all lessons.
Returns:
| Name | Type | Description |
|---|---|---|
JSON |
A list of formatted lesson objects. |
Errors: 400: Error formatting lessons 500: Unexpected server error
Source code in src/api/lesson.py
fetch_lesson_by_id
¶
Get a lesson by ID.
Source code in src/api/lesson.py
fetch_lesson_by_vowel_id
¶
Get a lesson by vowel ID.
Source code in src/api/lesson.py
update_existing_lesson
¶
Update an existing lesson.
Source code in src/api/lesson.py
Response Formats¶
Success Response¶
Success Response Format
Error Response¶
Error Response Format
Data¶
Lesson Object Format
{
"id": 1,
"vowel": {
"id": "v1",
"phoneme": "i",
"name": "Long E",
"ipa_example": "iː",
"color_code": "#FF5733",
"audio_url": "/audio/vowels/long_e.mp3",
"description": "The long E vowel sound",
"mouth_image_url": "/images/mouth/long_e.png"
},
"lesson_card": {
"pronounced": "as 'ee' in 'see'",
"common_spellings": ["ee", "ea", "e", "ie", "ei"],
"lips": "Spread wide",
"tongue": "High and forward in the mouth",
"example_words": [
{"word": "see", "ipa": "siː"},
{"word": "meet", "ipa": "miːt"},
{"word": "piece", "ipa": "piːs"}
]
}
}
Quiz API¶
Response Formats¶
Success Response¶
Success Response Format
Error Response¶
Error Response Format
Data¶
Quiz Item Object Format
{
"id": 1,
"prompt_word": "sheep",
"prompt_ipa": "ʃiːp",
"prompt_audio_url": "/audio/quiz/sheep.mp3",
"feedback_correct": "Great job! You identified the correct vowel sound.",
"feedback_incorrect": "Not quite. Listen to the difference again.",
"options": [
{
"id": 1,
"word": "ship",
"ipa": "ʃɪp",
"audio_url": "/audio/quiz/ship.mp3",
"is_correct": false,
"language": "en"
},
{
"id": 2,
"word": "sheep",
"ipa": "ʃiːp",
"audio_url": "/audio/quiz/sheep.mp3",
"is_correct": true,
"language": "en"
}
]
}