REST API¶
Authentication¶
Login¶
Đăng nhập và lấy access token.
Request Body:
Response:
Users¶
Get Current User¶
Response:
{
"id": 1,
"email": "admin@greenmap.hanoi",
"full_name": "Admin User",
"role": "admin",
"is_active": true
}
Create User¶
Request Body:
{
"email": "user@example.com",
"password": "securepassword",
"full_name": "New User",
"role": "citizen"
}
List Users (Admin only)¶
Reports¶
Create Report¶
Request Body:
title: Rác thải chưa thu gom
description: Bãi rác lớn tại góc đường...
latitude: 21.0285
longitude: 105.8542
image: [file]
Response:
{
"id": 123,
"title": "Rác thải chưa thu gom",
"description": "Bãi rác lớn tại góc đường...",
"latitude": 21.0285,
"longitude": 105.8542,
"image_url": "/uploads/reports/abc123.jpg",
"status": "PENDING",
"created_at": "2025-12-10T14:30:00Z"
}
List Reports¶
Query Parameters:
| Param | Type | Description |
|---|---|---|
| status | string | Filter by status (PENDING, APPROVED, REJECTED) |
| skip | int | Pagination offset |
| limit | int | Number of items per page |
Update Report Status¶
Request Body:
Locations¶
List Locations¶
Query Parameters:
| Param | Type | Description |
|---|---|---|
| type | string | Filter by type (park, charging, bicycle, tourist) |
| lat | float | Center latitude for geo query |
| lng | float | Center longitude for geo query |
| radius | float | Radius in km |
Create Location¶
Request Body:
{
"name": "Công viên Thống Nhất",
"type": "park",
"latitude": 21.0117,
"longitude": 105.8442,
"description": "Công viên lớn nhất Hà Nội",
"metadata": {
"area": 50000,
"facilities": ["playground", "lake", "jogging_track"]
}
}
Update Location¶
Delete Location¶
System¶
Health Check¶
Response: