API Documentation

Maths Learning Platform Endpoints

39 Endpoints

User Management

GET/api/users

Get all users with optional filtering

Query Parameters:

role, year_group, exam_board

Example:

/api/users?role=student&year_group=10
POST/api/users

Create a new user

Request Body:

{
  "name": "John Smith",
  "email": "john@email.com",
  "password": "password123",
  "role": "student",
  "year_group": 10,
  "target_grade": "A",
  "exam_board": "AQA",
  "parents_name": "Jane Smith"
}

Example:

/api/users
GET/api/users/[id]

Get specific user by ID

Example:

/api/users/123
PUT/api/users/[id]

Update user information

Request Body:

{
  "name": "John Smith Updated",
  "email": "john.updated@email.com",
  "role": "student",
  "active": true
}

Example:

/api/users/123
DELETE/api/users/[id]

Soft delete user (set active = false)

Example:

/api/users/123

Form Management

POST/api/root

Submit Maths Tutor Interest Form

Request Body:

{
  "learnerName": "John Smith",
  "parentName": "Jane Smith",
  "yeargroup": "Year 10",
  "school": "Manchester High School",
  "phone": "07123456789",
  "email": "jane.smith@email.com",
  "classPreference": "higher",
  "homework": "yes",
  "goals": "Improve algebra skills",
  "notes": "Struggles with quadratic equations"
}

Example:

/api/root
GETendpoints

Get all the endpoints

Example:

/endpoints
POST/api/users

Create a new user

Request Body:

{
  "name": "John Smith",
  "email": "john@email.com",
  "password": "password123",
  "role": "student",
  "year_group": 10,
  "target_grade": "A",
  "exam_board": "AQA",
  "parents_name": "Jane Smith"
}

Example:

/api/users
GET/api/users/[id]

Get specific user by ID

Example:

/api/users/123
PUT/api/users/[id]

Update user information

Request Body:

{
  "name": "John Smith Updated",
  "email": "john.updated@email.com",
  "role": "student",
  "active": true
}

Example:

/api/users/123
DELETE/api/users/[id]

Soft delete user (set active = false)

Example:

/api/users/123

Content Management

GET/api/content

Get all content with optional filtering

Query Parameters:

type, parent_id, published

Example:

/api/content?type=lesson&published=true
POST/api/content

Create new content (course, topic, or lesson)

Request Body:

{
  "parent_id": 1,
  "type": "lesson",
  "name": "Quadratic Equations",
  "description": "Learn to solve quadratic equations",
  "code": "MATH-L001",
  "grade_min": 9,
  "grade_max": 11,
  "published": true
}

Example:

/api/content
GET/api/content/[id]

Get specific content item

Example:

/api/content/456
PUT/api/content/[id]

Update content item

Request Body:

{
  "name": "Advanced Quadratic Equations",
  "description": "Updated description",
  "published": true
}

Example:

/api/content/456
DELETE/api/content/[id]

Delete content item

Example:

/api/content/456

Booking Management

GET/api/bookings

Get all bookings with tutor/student details

Query Parameters:

tutor_id, student_id, status, date_from, date_to

Example:

/api/bookings?status=scheduled&tutor_id=123
POST/api/bookings

Create new booking/session

Request Body:

{
  "tutor_id": 1,
  "student_id": 2,
  "scheduled_start": "2025-07-28T14:00:00Z",
  "scheduled_end": "2025-07-28T15:00:00Z",
  "content_id": 5,
  "cost": 25
}

Example:

/api/bookings
GET/api/bookings/[id]

Get specific booking details

Example:

/api/bookings/789
PUT/api/bookings/[id]

Update booking (complete session, add notes)

Request Body:

{
  "status": "completed",
  "session_notes": "Great progress on algebra",
  "homework_set": "Complete exercises 1-10",
  "rating": 5
}

Example:

/api/bookings/789

Progress Tracking

GET/api/progress

Get student progress records

Query Parameters:

user_id, content_id, status

Example:

/api/progress?user_id=123&status=completed
POST/api/progress

Create or update progress record

Request Body:

{
  "user_id": 2,
  "content_id": 5,
  "completion": 75,
  "status": "in_progress",
  "grade": 8.5,
  "strengths": "Good understanding of concepts",
  "areas_for_improvement": "Need more practice with word problems",
  "sessions_count": 3,
  "homework": "Complete chapter 5 exercises",
  "next_lesson_plan": "Move to advanced topics"
}

Example:

/api/progress

Assessment System

GET/api/questions

Get quiz questions with filtering

Query Parameters:

type, grade_min, grade_max, active

Example:

/api/questions?type=multiple_choice&grade_min=9
POST/api/questions

Create new question

Request Body:

{
  "text": "What is 2x + 5 = 13?",
  "type": "multiple_choice",
  "correct_answer": "4",
  "options": [
    "2",
    "4",
    "6",
    "8"
  ],
  "grade_min": 9,
  "grade_max": 11
}

Example:

/api/questions
GET/api/quizzes

Get all quizzes

Query Parameters:

content_id, published

Example:

/api/quizzes?published=true
POST/api/attempts

Submit quiz attempt

Request Body:

{
  "user_id": 2,
  "quiz_id": 1,
  "score": 85,
  "completed": true
}

Example:

/api/attempts

Student Management

GET/api/students

Get all students with filtering

Query Parameters:

year_group, target_grade, active

Example:

/api/students?year_group=10&active=true
POST/api/students

Create new student account

Request Body:

{
  "name": "Alice Johnson",
  "email": "alice@email.com",
  "year_group": 11,
  "target_grade": "A*",
  "exam_board": "Edexcel",
  "parents_name": "Sarah Johnson"
}

Example:

/api/students
PUT/api/students/[id]

Update student information

Request Body:

{
  "target_grade": "A*",
  "year_group": 12,
  "active": true
}

Example:

/api/students/123

Tutor Management

GET/api/tutors

Get all tutors with specializations

Query Parameters:

subject, grade_level, available

Example:

/api/tutors?subject=mathematics&available=true
POST/api/tutors

Create new tutor account

Request Body:

{
  "name": "Dr. Smith",
  "email": "smith@email.com",
  "specializations": [
    "Algebra",
    "Calculus"
  ],
  "hourly_rate": 35,
  "qualifications": "PhD Mathematics"
}

Example:

/api/tutors
PUT/api/tutors/[id]

Update tutor profile and availability

Request Body:

{
  "hourly_rate": 40,
  "available": true,
  "specializations": [
    "Advanced Calculus"
  ]
}

Example:

/api/tutors/456

Admin Settings

GET/api/settings

Get system settings

Example:

/api/settings
PUT/api/settings

Update system settings

Request Body:

{
  "platform_name": "MathsMaster Pro",
  "default_session_length": "60",
  "currency": "GBP"
}

Example:

/api/settings
GET/api/admin/reset-log

Get admin reset operations log

Query Parameters:

admin_id, target_user_id

Example:

/api/admin/reset-log
GET/api/admindb

Get admin dashboard with student list

Example:

/api/admindb
GET/api/admindb/[studentid]

Get individual student details

Example:

/api/admindb/1
GET/api/tutordb

Get tutor dashboard

Example:

/api/tutordb
GET/api/studentdb

Get student dashboard

Example:

/api/studentdb

Quick Start Guide

1. Authentication

Include JWT token in Authorization header for protected endpoints.

2. Content-Type

Set Content-Type: application/json for POST/PUT requests.

3. Error Handling

All endpoints return consistent error format with status codes.