76 lines
1.6 KiB
Markdown
76 lines
1.6 KiB
Markdown
# API Documentation
|
|
|
|
## Student Assistance AI API
|
|
|
|
### Core Endpoints
|
|
|
|
#### `POST /api/student-requests`
|
|
Process new student assistance requests through AI matching engine.
|
|
|
|
**Request Body:**
|
|
```typescript
|
|
{
|
|
studentId: string
|
|
description: string
|
|
category: 'clothing' | 'supplies' | 'food' | 'transportation' | 'emergency'
|
|
urgency: 'low' | 'medium' | 'high' | 'critical'
|
|
constraints: {
|
|
maxBudget?: number
|
|
timeframe: string
|
|
geographic?: {
|
|
maxDistance: number
|
|
preferredAreas?: string[]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
**Response:**
|
|
```typescript
|
|
{
|
|
requestId: string
|
|
status: 'pending' | 'processing' | 'matched' | 'completed'
|
|
matches: MatchResult[]
|
|
estimatedCompletion: string
|
|
aiConfidence: number
|
|
}
|
|
```
|
|
|
|
#### `GET /api/requests/{requestId}/status`
|
|
Get real-time status of a student request.
|
|
|
|
#### `POST /api/ai/feedback`
|
|
Submit feedback for AI model improvement.
|
|
|
|
**Request Body:**
|
|
```typescript
|
|
{
|
|
requestId: string
|
|
matchId: string
|
|
outcome: 'successful' | 'partial' | 'failed'
|
|
feedback: {
|
|
satisfactionScore: number (1-5)
|
|
issues?: string[]
|
|
improvements?: string[]
|
|
}
|
|
}
|
|
```
|
|
|
|
### Error Handling
|
|
|
|
All API endpoints return errors in the following format:
|
|
```typescript
|
|
{
|
|
error: {
|
|
code: string
|
|
message: string
|
|
details?: any
|
|
}
|
|
}
|
|
```
|
|
|
|
Common error codes:
|
|
- `INVALID_REQUEST`: Request format is incorrect
|
|
- `AI_MODEL_UNAVAILABLE`: AI service is temporarily unavailable
|
|
- `INSUFFICIENT_RESOURCES`: No matching resources found
|
|
- `RATE_LIMIT_EXCEEDED`: Too many requests from client |