Proxy Services
Dokumentasi API endpoints yang di-proxy ke microservices lain.
Overview
API Gateway bertindak sebagai entry point untuk semua microservices. Request ke services lain akan di-proxy oleh API Gateway.
Available Services
| Service | Base Path | Environment Variable |
|---|---|---|
| Master Data | /api/v1/master-data/ | SERVER_SERVICE_MASTER_DATA |
| Kepegawaian | /api/v1/kepegawaian/ | SERVER_SERVICE_KEPEGAWAIAN |
| Keuangan | /api/v1/keuangan/ | SERVER_SERVICE_KEUANGAN |
| Perizinan | /api/v1/perizinan/ | SERVER_SERVICE_PERIZINAN |
| Pelaporan | /api/v1/pelaporan/ | SERVER_SERVICE_PELAPORAN |
| Tramtibum | /api/v1/tramtibum/ | SERVER_SERVICE_TRAMTIBUM |
| File | /api/v1/file/ | SERVER_SERVICE_FILE |
| Notification | /api/v1/notification/ | SERVER_SERVICE_NOTIFICATION |
Master Data Service
Base URL
/api/v1/master-data
Common Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /provinsi | Daftar provinsi |
| GET | /kabupaten-kota | Daftar kabupaten/kota |
| GET | /kecamatan | Daftar kecamatan |
| GET | /kelurahan | Daftar kelurahan |
| GET | /satuan-kerja | Daftar satuan kerja |
| GET | /jabatan | Daftar jabatan |
Example:
curl -X GET "http://localhost:8000/api/v1/master-data/provinsi" \
-H "Authorization: xxxTOKENxxxxx"
Kepegawaian Service
Base URL
/api/v1/kepegawaian
Common Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /pegawai | Daftar pegawai |
| GET | /pegawai/:id | Detail pegawai |
| POST | /pegawai | Tambah pegawai |
| PUT | /pegawai/:id | Update pegawai |
| DELETE | /pegawai/:id | Hapus pegawai |
| GET | /riwayat-jabatan | Riwayat jabatan |
| GET | /riwayat-pendidikan | Riwayat pendidikan |
Example:
curl -X GET "http://localhost:8000/api/v1/kepegawaian/pegawai" \
-H "Authorization: xxxTOKENxxxxx"
Keuangan Service
Base URL
/api/v1/keuangan
Common Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /gaji | Data gaji |
| GET | /tunjangan | Data tunjangan |
| GET | /potongan | Data potongan |
| GET | /slip-gaji | Slip gaji |
Example:
curl -X GET "http://localhost:8000/api/v1/keuangan/slip-gaji?bulan=1&tahun=2024" \
-H "Authorization: xxxTOKENxxxxx"
Perizinan Service
Base URL
/api/v1/perizinan
Common Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /cuti | Daftar cuti |
| POST | /cuti | Ajukan cuti |
| PUT | /cuti/:id | Update cuti |
| GET | /izin | Daftar izin |
| POST | /izin | Ajukan izin |
Example:
curl -X POST "http://localhost:8000/api/v1/perizinan/cuti" \
-H "Content-Type: application/json" \
-H "Authorization: xxxTOKENxxxxx" \
-d '{
"tanggal_mulai": "2024-02-01",
"tanggal_selesai": "2024-02-05",
"jenis_cuti": "tahunan",
"keterangan": "Liburan keluarga"
}'
Pelaporan Service
Base URL
/api/v1/pelaporan
Common Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /laporan | Daftar laporan |
| POST | /laporan | Buat laporan |
| GET | /laporan/:id | Detail laporan |
| GET | /statistik | Statistik pelaporan |
Example:
curl -X GET "http://localhost:8000/api/v1/pelaporan/statistik?tahun=2024" \
-H "Authorization: xxxTOKENxxxxx"
Tramtibum Service
Base URL
/api/v1/tramtibum
Common Endpoints
| Method | Path | Description |
|---|---|---|
| GET | /kegiatan | Daftar kegiatan |
| POST | /kegiatan | Buat kegiatan |
| GET | /kegiatan/:id | Detail kegiatan |
| GET | /penindakan | Daftar penindakan |
Example:
curl -X GET "http://localhost:8000/api/v1/tramtibum/kegiatan" \
-H "Authorization: xxxTOKENxxxxx"
File Service
Base URL
/api/v1/file
Common Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /upload | Upload file |
| GET | /:id | Download file |
| DELETE | /:id | Delete file |
Example Upload:
curl -X POST "http://localhost:8000/api/v1/file/upload" \
-H "Authorization: xxxTOKENxxxxx" \
-F "file=@/path/to/file.pdf" \
-F "folder=documents"
Example Download:
curl -X GET "http://localhost:8000/api/v1/file/550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: xxxTOKENxxxxx" \
--output downloaded_file.pdf
Notification Service
Base URL
/api/v1/notification
Common Endpoints
| Method | Path | Description |
|---|---|---|
| GET | / | Daftar notifikasi |
| GET | /:id | Detail notifikasi |
| PUT | /:id/read | Mark as read |
| DELETE | /:id | Delete notifikasi |
| GET | /unread-count | Jumlah belum dibaca |
Example:
curl -X GET "http://localhost:8000/api/v1/notification?status=unread" \
-H "Authorization: xxxTOKENxxxxx"
Proxy Behavior
Request Forwarding
Semua request akan di-forward dengan:
- Original headers (except
Host) - Original query parameters
- Original request body
- Added
Authorizationheader
Response Handling
Response dari upstream service akan dikembalikan as-is, termasuk:
- Status code
- Response headers
- Response body
Error Handling
| Scenario | Status Code | Message |
|---|---|---|
| Service not configured | 503 | Service unavailable |
| Service unreachable | 502 | Bad gateway |
| Timeout | 504 | Gateway timeout |
Swagger Documentation
Dokumentasi Swagger dari semua services digabung dan tersedia di:
GET /api/v1/docs.json
Swagger UI:
GET /api/v1/swagger/index.html