This repository contains the API for managing and retrieving data related to administrative regions in a given country. The API allows clients to fetch information about provinces, cities, districts, subdistricts, and postal codes.
git clone [repository-url]
cd [repository-name]
# Install dependencies
npm install
npm start:dev
# or
npm start
The API exposes several endpoints for retrieving regional data:
GET /wilayah/provinces: Retrieves a list of provinces. Can be filtered by the 'name' query parameter.
GET /wilayah/cities: Retrieves a list of cities. Can be filtered by 'name', 'provinceId', or 'id' query parameters.
GET /wilayah/districts: Retrieves a list of districts. Can be filtered by 'name', 'cityId', or 'id' query parameters.
GET /wilayah/subdistricts: Retrieves a list of subdistricts. Can be filtered by 'name', 'districtId', or 'id' query parameters.
GET /wilayah/postal-codes: Retrieves a list of postal codes. Can be filtered by 'code' or 'subDistrictId' query parameters.
// Fetch provinces
fetch('/wilayah/provinces')
.then(response => response.json())
.then(data => console.log(data));
// Fetch cities by province ID
fetch('/wilayah/cities?provinceId=12345')
.then(response => response.json())
.then(data => console.log(data));
The API uses conventional HTTP response codes to indicate the success or failure of an API request.
Just submitting pull requests to us.
For any queries, you can reach out to my linkedin.