Tài liệu API
Smrt English Client API
API chỉ đọc, trả dữ liệu học viên và lớp học về hệ thống của đơn vị. Mỗi khóa API (API key) chỉ truy cập được dữ liệu của chính đơn vị sở hữu khóa đó.
Cách thức hoạt động
Cách một yêu cầu được xử lý.
Hệ thống của đơn vị gửi yêu cầu lấy dữ liệu một học viên hoặc một lớp kèm khóa API riêng, và API trả về dữ liệu ở chế độ chỉ đọc.
Smrt English API
Get Classes List Endpoint
Endpoint Details
Endpoint: GET /smrtapi/v1/classes
Purpose: Retrieve a paginated list of classes with summary statistics. Perfect for class roster management, teacher assignment tracking, and institutional reporting.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page |
integer | 1 | Page number (must be ≥ 1) |
limit |
integer | 50 | Results per page (1-100) |
status |
integer | - | Filter by status (0=inactive, 1=active) |
course_id |
integer | - | Filter by specific course |
teacher_id |
integer | - | Filter by teacher ID |
teacher_email |
string | - | Filter by teacher email address |
search |
string | - | Search by class title or class code |
Headers Required
X-API-Key: your_institution_api_key
Example Requests
# Get first page (default 50 classes) curl -H "X-API-Key: your_institution_api_key" \ https://smrtenglish.com/smrtapi/v1/classes # Get specific page with custom limit curl -H "X-API-Key: your_institution_api_key" \ "https://smrtenglish.com/smrtapi/v1/classes?page=2&limit=25" # Filter by active classes only curl -H "X-API-Key: your_institution_api_key" \ "https://smrtenglish.com/smrtapi/v1/classes?status=1" # Filter by teacher email curl -H "X-API-Key: your_institution_api_key" \ "https://smrtenglish.com/smrtapi/v1/[email protected]" # Filter by course curl -H "X-API-Key: your_institution_api_key" \ "https://smrtenglish.com/smrtapi/v1/classes?course_id=12"
Response Example (abbreviated):
{
"success": true,
"data": [
{
"class_id": 456,
"class_title": "English 101 - Section A",
"class_code": "ENG101-A",
"class_status": 1,
"class_room": "Room 204",
"class_dateadded": "2024-01-10",
"course": {
"course_id": 12,
"course_name": "General English"
},
"teacher": {
"teacher_id": 78,
"name": "Jane Smith",
"email": "[email protected]"
},
"student_count": 25,
"summary": {
"average_completion_rate": 82.5,
"average_score": 78.3,
"total_engagement_minutes": 1250.5
},
"assignment_activity": {
"has_assignments": true,
"assignment_count": 15,
"first_assignment_date": "2024-01-15",
"last_assignment_date": "2024-10-05",
"students_enrolled": 25,
"students_with_submissions": 22,
"students_without_submissions": 3
}
}
],
"pagination": {
"page": 1,
"limit": 50,
"total_count": 15,
"total_pages": 1,
"has_next": false,
"has_prev": false
}
}
Use Cases
- Class Roster Export - Pull complete class lists for institutional reporting
- Teacher Workload Analysis - Track how many classes each teacher manages
- Course Enrollment Reports - See how many sections exist for each course
- Performance Comparison - Compare performance metrics across different classes
- Active Class Monitoring - Track which classes are currently active vs archived
- Integration with Scheduling - Sync class data with scheduling systems
Response Format
Returns a paginated list of classes with summary statistics:
Response Fields - Class Object
| Field | Type | Description |
|---|---|---|
class_id |
integer | Unique class identifier |
class_title |
string | Class name/title |
class_code |
string | Class code/section identifier |
class_status |
integer | Status (0=inactive, 1=active) |
student_count |
integer | Number of enrolled students |
course.course_id |
integer | Associated course ID |
teacher.name |
string | Primary teacher name |
summary.average_completion_rate |
float | Average completion rate (0-100) |
summary.average_score |
float | Average assignment score (0-100) |
Pagination Object:
page- Current page numberlimit- Results per pagetotal_count- Total classes matching filtertotal_pages- Total pages availablehas_next- Boolean, true if more pages existhas_prev- Boolean, true if previous page exists
Filtering Best Practices
- Use
status=1to get only active classes for current reporting - Use
teacher_emailto get all classes for a specific teacher - Use
course_idto see all sections of a particular course - Combine filters for precise queries (e.g., active classes for a specific teacher)
Example: Get All Classes for a Teacher
import requests api_key = "your_institution_api_key" teacher_email = "[email protected]" base_url = "https://smrtenglish.com/smrtapi/v1/classes" headers = {"X-API-Key": api_key} response = requests.get( base_url, headers=headers, params={"teacher_email": teacher_email, "status": 1} ) data = response.json() classes = data["data"] print(f"Teacher {teacher_email} has {len(classes)} active classes") for cls in classes: print(f" - {cls['class_title']} ({cls['student_count']} students)")
Note: For detailed class data including full student roster with individual progress, use the Get Single Class endpoint.