Deze guide beschrijft hoe je de REST API service gebruikt om toegang te krijgen tot het datalake en de databases.
De Platform API service exposeert een REST API op poort 8082 voor externe projecten.
Base URL: http://localhost:8082 (development)
Production: Configureer via environment variables
Alle API requests vereisen een API key in de header:
X-API-Key: your-api-key-here
API keys worden gegenereerd en beheerd via de API service configuratie. Zie projects/platform-api/README.md voor setup instructies.
GET /api/students
Response:
{
"success": true,
"data": [
{
"id": "clxxx...",
"name": "Amirah",
"email": "[email protected]",
"datalakePath": "notability/Priveles/VO/Amirah",
"schoolLevel": "HAVO",
"createdAt": "2024-01-01T00:00:00Z"
}
],
"total": 1
}
Query Parameters:
limit - Aantal resultaten (default: 100)offset - Paginatie offset (default: 0)search - Zoek op naam (case-insensitive)GET /api/students/:id
Response:
{
"success": true,
"data": {
"id": "clxxx...",
"name": "Amirah",
"email": "[email protected]",
"datalakePath": "notability/Priveles/VO/Amirah",
"lessons": [],
"guardians": []
}
}
GET /api/lessons
Query Parameters:
studentId - Filter op student IDstartDate - Start datum (ISO format)endDate - Eind datum (ISO format)limit - Aantal resultatenoffset - Paginatie offsetGET /api/appointments
Query Parameters:
studentId - Filter op student IDstartDate - Start datum (ISO format)endDate - Eind datum (ISO format)GET /api/datalake/students
Response:
{
"success": true,
"data": [
{
"name": "Amirah",
"path": "notability/Priveles/VO/Amirah",
"subject": "wiskunde-a",
"fileCount": 15
}
]
}
Query Parameters:
search - Zoek op student naamsubject - Filter op subject (VO, Rekenen, WO)GET /api/datalake/students/:name/files
Response:
{
"success": true,
"data": {
"studentName": "Amirah",
"path": "notability/Priveles/VO/Amirah",
"files": [
{
"name": "Les 1 - Algebra.pdf",
"path": "notability/Priveles/VO/Amirah/Les 1 - Algebra.pdf",
"size": 1234567,
"modifiedTime": "2024-01-15T10:30:00Z",
"downloadUrl": "http://localhost:8082/api/datalake/files/.../download?token=..."
}
]
}
}
GET /api/datalake/files/:path
Path: URL-encoded file path (bijv. notability%2FPriveles%2FVO%2FAmirah%2FLes%201.pdf)
Response:
{
"success": true,
"data": {
"name": "Les 1 - Algebra.pdf",
"path": "notability/Priveles/VO/Amirah/Les 1 - Algebra.pdf",
"size": 1234567,
"modifiedTime": "2024-01-15T10:30:00Z",
"mimeType": "application/pdf",
"metadata": {
"subject": "wiskunde-a",
"topic": "algebra",
"level": "vo-havo-onderbouw"
}
}
}
GET /api/datalake/files/:path/download
Path: URL-encoded file path
Response:
{
"success": true,
"data": {
"downloadUrl": "http://localhost:9005/bronze-education/...?X-Amz-Algorithm=...",
"expiresIn": 3600
}
}
De downloadUrl is een presigned URL die 1 uur geldig is.
De API heeft rate limiting om misbruik te voorkomen:
Response headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640000000
Bij overschrijding:
{
"success": false,
"error": "Rate limit exceeded",
"retryAfter": 60
}
Alle errors volgen dit format:
{
"success": false,
"error": "Error message",
"code": "ERROR_CODE"
}
200 - Success400 - Bad Request (invalid parameters)401 - Unauthorized (missing/invalid API key)404 - Not Found429 - Too Many Requests (rate limit exceeded)500 - Internal Server Errorconst API_BASE_URL = 'http://localhost:8082';
const API_KEY = 'your-api-key-here';
async function getStudents() {
const response = await fetch(`${API_BASE_URL}/api/students`, {
headers: {
'X-API-Key': API_KEY
}
});
const data = await response.json();
return data.data;
}
async function getStudentFiles(studentName) {
const encodedName = encodeURIComponent(studentName);
const response = await fetch(
`${API_BASE_URL}/api/datalake/students/${encodedName}/files`,
{
headers: {
'X-API-Key': API_KEY
}
}
);
const data = await response.json();
return data.data.files;
}
import requests
API_BASE_URL = 'http://localhost:8082'
API_KEY = 'your-api-key-here'
headers = {
'X-API-Key': API_KEY
}
def get_students():
response = requests.get(
f'{API_BASE_URL}/api/students',
headers=headers
)
data = response.json()
return data['data']
def get_student_files(student_name):
encoded_name = requests.utils.quote(student_name)
response = requests.get(
f'{API_BASE_URL}/api/datalake/students/{encoded_name}/files',
headers=headers
)
data = response.json()
return data['data']['files']
# List students
curl -H "X-API-Key: your-api-key-here" \
http://localhost:8082/api/students
# Get student files
curl -H "X-API-Key: your-api-key-here" \
"http://localhost:8082/api/datalake/students/Amirah/files"
Zie projects/platform-api/README.md voor setup instructies en API key configuratie.
Voor productie: