Developed using ASP.NET Core Web Api + direct query. Live demo here
Returns json data about address detail. Some address may return multiple postcode due to addresses with similar name
-
URL
/api/postcode/ByAddress
-
Method:
GET
-
Data Params
Required:
state=[string]
address=[string]
-
Sample Call:
curl -X 'GET' \
'https://localhost:7173/api/postcode/ByAddress?state=melaka&address=bukit%20beruang' \
-H 'accept: */*'
-
Success Response:
- Code: 200
Content:{ "state": "MLK", "detail": [ { "postcode": "75450", "address": "Bukit Beruang", "district": "Ayer Keroh" } ] }
- Code: 200
-
Error Response:
-
Code: 200
Content:
{ "state": null, "detail": [] }
-
Returns json data about all address detail in district
-
URL
/api/postcode/ByDistrict
-
Method:
GET
-
Data Params
Required:
state=[string]
district=[string]
-
Sample Call:
curl -X 'GET' \
'https://localhost:7173/api/postcode/ByDistrict?state=melaka&district=ayer%20keroh' \
-H 'accept: */*'
-
Success Response:
- Code: 200
Content:{ "state": "MLK", "detail": [ { "postcode": "75450", "address": "Air Keroh D Village Resort", "district": "Ayer Keroh" }, { "postcode": "75450", "address": "Ayer Keroh Country Resort", "district": "Ayer Keroh" }, { "postcode": "75450", "address": "Bangunan LHDN Hang Tuah Jaya", "district": "Ayer Keroh" }, { "postcode": "75450", "address": "Bangunan TM Hang Tuah Jaya", "district": "Ayer Keroh" } ... }
- Code: 200
-
Error Response:
-
Code: 200
Content:
{ "state": null, "detail": [] }
-
johor
kedah
kelantan
kuala_lumpur
labuan
melaka
negeri_sembilan
pahang
penang
perak
perlis
putrajaya
sabah
sarawak
selangor
terengganu
heiswayi for postcode list