🎓 GK Quiz API

RESTful API for General Knowledge Quiz Application

API Endpoints

Get All Subjects

GET
/api/subjects.php

Returns list of all active subjects with their icons and display order.

Test Endpoint

Get Chapters by Subject

GET
/api/chapters.php?subject_id=1

Returns all chapters for a specific subject along with question counts.

Test Endpoint

Get Questions by Subject (Study Mode)

GET
/api/questions.php?subject_id=1&mode=study

Returns ALL questions for a subject in study mode (unlimited). Optional: &chapter=ChapterName to filter by chapter.

Test Endpoint

Get Questions by Subject (Mock Test Mode)

GET
/api/questions.php?subject_id=1&mode=mock_test

Returns EXACTLY 10 random questions for mock test. Optional: &chapter=ChapterName to filter by chapter.

Test Endpoint

Get Questions by Subject and Chapter

GET
/api/questions.php?subject_id=1&chapter=Ancient India

Returns all questions for a specific subject and chapter. Chapter name must match exactly.

Test Endpoint

Submit Test Result

POST
/api/submit_test.php

Submit test results with scores and statistics. Requires JSON body: {"subject_id": 1, "total_questions": 10, "correct_answers": 7, "wrong_answers": 3}

Get Dashboard Statistics

GET
/api/dashboard_stats.php

Returns dashboard statistics including total subjects, questions, chapters, and recent test results.

Test Endpoint

🔗 Flutter Integration

Update your Flutter app's base URL:

class ApiService {
  static const String baseUrl = 'https://gk.apsterminal.com/api/';
  
  // For Android Emulator: http://10.0.2.2/gk_quiz_backend/api/
  // For Real Device: http://192.168.1.X/gk_quiz_backend/api/
}

⚠️ Default Admin Credentials

Username: admin
Password: admin123

Please change the password after first login!