Complete REST API for Learning Management System
All protected endpoints require a Firebase ID token in the Authorization header:
Authorization: Bearer YOUR_FIREBASE_ID_TOKEN
Get your token from Firebase Authentication after login.
http://api.dubhub.lk/api
{ "idToken": "your_firebase_id_token" }
?examYear=2025&limit=50&offset=0
{
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"phoneNumber": "0771234567",
"examYear": "2025",
"schoolName": "Example School",
...
}
?targetYear=2025&limit=20
{
"title": "Important Notice",
"message": "Notice content here",
"imageUrl": "https://...",
"targetAudience": "2025"
}
?targetYear=2025&accessType=lifetime
{
"title": "Mathematics Class",
"description": "Advanced algebra",
"youtubeLink": "https://youtube.com/...",
"targetYear": "2025",
"accessType": "lifetime"
}
?targetYear=2025&status=active
?type=note&targetYear=2025&subject=Mathematics
{
"examId": "exam123",
"answers": [...],
"score": 85,
"totalPoints": 100
}
?startDate=2024-01-01&endDate=2024-01-31
{
"hours": 9,
"date": "2024-01-15"
}
Success Response:
{
"success": true,
"data": { ... },
"message": "Operation successful"
}
Error Response:
{
"error": "Error Type",
"message": "Detailed error message"
}
1. Get Firebase ID Token:
// After Firebase Authentication
const idToken = await user.getIdToken();
2. Make API Request:
fetch('http://api.dubhub.lk/api/students', {
method: 'GET',
headers: {
'Authorization': 'Bearer ' + idToken,
'Content-Type': 'application/json'
}
})
.then(res => res.json())
.then(data => console.log(data));