Main API
Overview
Section titled “Overview”Main API adalah core business logic service. Menangani manajemen keluarga, relawan, collector, pengumpulan UCO, pickup request, impact tracking, dan CMS.
- REST: Port 8081 (dev) / 8080 (prod)
- Base URL (prod):
https://api.waqfuel.com - Auth: JWT via
Authorization: Bearer <token>(validated via JWKS dari auth-api)
Public Endpoints
Section titled “Public Endpoints”Health Check
Section titled “Health Check”GET /healthResponse includes status DB dan gRPC connections.
Impact (Public)
Section titled “Impact (Public)”GET /impact/platform # Platform-wide impact statsGET /impact/family/{id} # Impact per family (by ID)GET /impact/family-by-code/{code} # Impact per family (by public code)GET /impact-factors # List impact factorsGET /impact-factors/{key}/total/global # Global total per factorGET /impact-factors/{key}/monthly/global # Monthly breakdownGET /impact-factors/{key}/yearly/global # Yearly breakdownLanding Page (Public CMS)
Section titled “Landing Page (Public CMS)”GET /landing/hero # Hero section contentGET /landing/branding # Branding infoGET /landing/footer # Footer contentGallery (Public)
Section titled “Gallery (Public)”GET /gallery/categories # List categoriesGET /gallery/categories/tree # Categories as treeGET /gallery/photos # Public photosGET /gallery/photos/recent # Recent photosProtected Endpoints
Section titled “Protected Endpoints”Family Management
Section titled “Family Management”POST /families # Buat keluarga baruGET /families # List keluarga (filtered by volunteer area)GET /families/{id} # Detail keluargaPATCH /families/{id} # Update keluargaRequest body (create):
{ "name": "Keluarga Budi", "phone": "+628123456789", "province": "DKI Jakarta", "city": "Jakarta Selatan", "district": "Kebayoran Baru", "village": "Senayan", "rtrw": "RT 003/RW 005"}Volunteer Management
Section titled “Volunteer Management”POST /volunteers # Register volunteerGET /volunteers # List volunteersGET /volunteers/{id} # DetailPATCH /volunteers/{id} # Update service areaCollection Tracking
Section titled “Collection Tracking”POST /collections # Catat pengumpulan UCOGET /collections # List collectionsGET /collections/unbatched # Collections belum di-batchGET /collections/{id} # DetailDELETE /collections/{id} # HapusPOST /collections/upload-url # Get presigned URL untuk bukti fotoRequest body (create):
{ "family_id": "uuid", "liters": 2.5, "notes": "Minyak jelantah dari penggorengan"}Pickup Requests
Section titled “Pickup Requests”Lihat Pickup Request Workflow untuk state machine lengkap.
POST /pickup-requests # Buat draftGET /pickup-requests # ListGET /pickup-requests/{id} # DetailPATCH /pickup-requests/{id} # Edit draftDELETE /pickup-requests/{id} # Hapus draftPOST /pickup-requests/{id}/submit # SubmitPOST /pickup-requests/{id}/approve # ApprovePOST /pickup-requests/{id}/reject # RejectPOST /pickup-requests/{id}/reopen # ReopenPOST /pickup-requests/{id}/mark-picked-up # Mark picked upPOST /pickup-requests/{id}/verify # VerifyPOST /pickup-requests/{id}/complete # CompletePOST /pickup-requests/{id}/cancel # CancelImpact Factors (Admin)
Section titled “Impact Factors (Admin)”GET /impact-factors/admin # List (admin view)POST /impact-factors # Create factorPATCH /impact-factors/{id} # Update factorDELETE /impact-factors/{id} # Delete factorGET /impact-factors/{key}/history # Audit trail (super_admin)Admin User Management
Section titled “Admin User Management”GET /admin/users # List all usersPOST /admin/users # Create user (invitation flow)GET /admin/users/{id} # DetailDELETE /admin/users/{id} # Hard deletePATCH /admin/users/{id}/testing-flag # Toggle testing flagPOST /admin/users/{id}/resend-invitation # Resend invitation emailLanding CMS (Admin)
Section titled “Landing CMS (Admin)”GET /admin/landing/hero # Get heroPUT /admin/landing/hero # Update heroGET /admin/landing/branding # Get brandingPUT /admin/landing/branding # Update brandingGET /admin/landing/footer # Get footerPUT /admin/landing/footer # Update footerPOST /admin/landing/upload-url # Presigned URL for mediaGallery Admin
Section titled “Gallery Admin”POST /admin/gallery/categories # Create categoryPATCH /admin/gallery/categories/{id} # Update categoryDELETE /admin/gallery/categories/{id} # Delete categoryPOST /admin/gallery/photos # Add photoPATCH /admin/gallery/photos/{id} # Update photoDELETE /admin/gallery/photos/{id} # Delete photoPOST /admin/gallery/upload-url # Presigned URLRole-Based Access
Section titled “Role-Based Access”| Endpoint Group | volunteer | collector | admin | super_admin |
|---|---|---|---|---|
| Family CRUD | area-filtered | - | all | all |
| Collection CRUD | own | - | all | all |
| Pickup Request | create/submit | mark-picked-up | approve/reject/complete | all |
| Impact Factors | read | read | CRUD | CRUD + history |
| Admin Users | - | - | limited | full |
| Landing CMS | - | - | full | full |
| Gallery | - | - | full | full |