Skip to content

Reference API

Reference API menyediakan data lokasi hierarchical (provinsi → kota → kecamatan → kelurahan) dan validasi foto profil. Service ini read-only untuk data lokasi.

  • REST: Port 4000 (dev/prod)
  • gRPC: Port 50050 (internal only)
GET /provinces

Response 200 OK:

[
{ "id": 11, "name": "ACEH" },
{ "id": 12, "name": "SUMATERA UTARA" },
{ "id": 31, "name": "DKI JAKARTA" }
]
GET /city_regencies
GET /city_regencies?province_id=31

Response 200 OK:

[
{ "id": 3101, "province_id": 31, "name": "KAB. ADM. KEP. SERIBU" },
{ "id": 3171, "province_id": 31, "name": "KOTA ADM. JAKARTA PUSAT" },
{ "id": 3174, "province_id": 31, "name": "KOTA ADM. JAKARTA SELATAN" }
]
GET /districts
GET /districts?city_id=3174
GET /villages
GET /villages?district_id=317401
POST /upload-profile-photo
Content-Type: multipart/form-data
file: <binary image data>

Validasi:

  • Max size: 1MB
  • Formats: JPEG, PNG, WebP
  • Returns presigned S3 URL

Dipanggil oleh auth-api untuk validasi data lokasi saat registrasi dan validasi foto.

service ReferenceService {
rpc ValidateLocation (ValidateLocationRequest)
returns (ValidateLocationResponse);
rpc ValidateProfilePhoto (ValidateProfilePhotoRequest)
returns (ValidateProfilePhotoResponse);
}

Memvalidasi bahwa kombinasi province/city/district/village valid dan terdaftar dalam database.

message ValidateLocationRequest {
string province = 1;
string city = 2;
string district = 3;
string village = 4;
}
message ValidateLocationResponse {
bool valid = 1;
string message = 2;
}

Database waqfuel_reference berisi tabel locations dengan seluruh data administratif Indonesia:

LevelJumlah
Provinsi38
Kota/Kabupaten~514
Kecamatan~7.277
Kelurahan/Desa~83.931

Data di-import via SQL migration file (~2.8MB). Lihat Troubleshooting jika migration lama.

Env VarDeskripsiContoh
API_PORTPort REST server4000
GRPC_PORTPort gRPC server50050
DATABASE_URLPostgreSQL connection stringpostgresql://localhost/waqfuel_reference
AWS_ENDPOINTS3 endpointhttps://s3.ap-southeast-1.amazonaws.com
AWS_BUCKET_ASSETSS3 bucketwaqfuel-assets-dev
AWS_REGIONAWS regionap-southeast-1