I want to use oneMap Search API to obtain the address details (block no, building name and street name) by postal code. When testing the API, I discovered that the API can return the result which contains more than one addresses. As per below examples, there are two records in each result and first record seems to be the actual building name and NIL but the second record is the pre-school name in the building name field.
If I want to get the building name, can I always use the first record from the result?
Example 1.
Request
https://developers.onemap.sg/commonapi/search?searchVal=560172&returnGeom=N&getAddrDetails=Y&pageNum=1
Response
{
"found": 2,
"totalNumPages": 1,
"pageNum": 1,
"results": [
{
"SEARCHVAL": "KEBUN BARU LINK 1",
"BLK_NO": "172",
"ROAD_NAME": "ANG MO KIO AVENUE 4",
"BUILDING": "KEBUN BARU LINK 1",
"ADDRESS": "172 ANG MO KIO AVENUE 4 KEBUN BARU LINK 1 SINGAPORE 560172",
"POSTAL": "560172"
},
{
"SEARCHVAL": "PCF SPARKLETOTS PRESCHOOL @ KEBUN BARU 172 (CC)",
"BLK_NO": "172",
"ROAD_NAME": "ANG MO KIO AVENUE 4",
"BUILDING": "PCF SPARKLETOTS PRESCHOOL @ KEBUN BARU 172 (CC)",
"ADDRESS": "172 ANG MO KIO AVENUE 4 PCF SPARKLETOTS PRESCHOOL @ KEBUN BARU 172 (CC) SINGAPORE 560172",
"POSTAL": "560172"
}
]
}
Example 2.
Request
https://developers.onemap.sg/commonapi/search?searchVal=381122&returnGeom=N&getAddrDetails=Y&pageNum=1
Response
{
"found": 2,
"totalNumPages": 1,
"pageNum": 1,
"results": [
{
"SEARCHVAL": "122 PAYA LEBAR WAY SINGAPORE 381122",
"BLK_NO": "122",
"ROAD_NAME": "PAYA LEBAR WAY",
"BUILDING": "NIL",
"ADDRESS": "122 PAYA LEBAR WAY SINGAPORE 381122",
"POSTAL": "381122"
},
{
"SEARCHVAL": "MORAL CHILD DEVELOPMENT CENTRE (MACPHERSON)",
"BLK_NO": "122",
"ROAD_NAME": "PAYA LEBAR WAY",
"BUILDING": "MORAL CHILD DEVELOPMENT CENTRE (MACPHERSON)",
"ADDRESS": "122 PAYA LEBAR WAY MORAL CHILD DEVELOPMENT CENTRE (MACPHERSON) SINGAPORE 381122",
"POSTAL": "381122"
}
]
}