Skip to content
Beebeeoii edited this page Aug 31, 2020 · 4 revisions

Usage of SGCommute API

Routes

Regarding bus services

All bus services' details

https://sgcommute-287703.appspot.com/buses

Response:

{"totalBuses": XX,
 "value": [{"ServiceNo":"XX","Operator":"XX","Direction":X,"Category":"XX","OriginCode":"XX","DestinationCode":"XX","AM_Peak_Freq":"XX","AM_Offpeak_freq":"XX","PM_Peak_Freq":"XX","PM_Offpeak_Freq":"XX","LoopDesc":"XX"}, ...],
 "isAPIKeyValid: XX"}

Single bus service's details

https://sgcommute-287703.appspot.com/{busServiceNumber} where busServiceNumber=27 for bus 27

Response:

{"ServiceNo":"XX","Operator":"XX","Direction":X,"Category":"XX","OriginCode":"XX","DestinationCode":"XX","AM_Peak_Freq":"XX","AM_Offpeak_freq":"XX","PM_Peak_Freq":"XX","PM_Offpeak_Freq":"XX","LoopDesc":"XX"}

Single bus service's route

https://sgcommute-287703.appspot.com/{busServiceNumber}/route where busServiceNumber=27 for bus 27

Response:

{"totalStops": XX,
 "value": [{"ServiceNo":"XX","Operator":"XX","Direction":XX,"StopSequence":XX,"BusStopCode":"XX","Distance":X,"WD_FirstBus":"XX","WD_LastBus":"XX","SAT_FirstBus":"XX","SAT_LastBus":"XX","SUN_FirstBus":"XX","SUN_LastBus":"XX"}, ...],
 "isAPIKeyValid: XX"}

Regarding bus stops

All bus stops details

https://sgcommute-287703.appspot.com/busstops

Response:

{"totalBusStops": XX,
 "value": [{"BusStopCode":"XX","RoadName":"XX","Description":"XX","Latitude":XX,"Longitude":XX}, ...],
 "isAPIKeyValid: XX"}

Single bus stop's details

https://sgcommute-287703.appspot.com/busstops/{busStopNumber} where busStopNumber=01012 for bus stop 01012

Response:

{"BusStopCode":"XX","RoadName":"XX","Description":"XX","Latitude":XX,"Longitude":XX}

All bus arrival timings at a single bus stop

https://sgcommute-287703.appspot.com/busstops/{busStopNumber}/arrivals where busStopNumber=01012 for bus stop 01012

Response:

{"totalBuses": XX,
 "Services": [{"ServiceNo":"XX",
               "Operator":"XX",
               "NextBus":{"OriginCode":"XX","DestinationCode":"XX","EstimatedArrival":"XX","Latitude":"XX","Longitude":"XX","VisitNumber":"XX","Load":"XX","Feature":"XX","Type":"XX"},
               "NextBus2":{"OriginCode":"XX","DestinationCode":"XX","EstimatedArrival":"XX","Latitude":"XX","Longitude":"XX","VisitNumber":"XX","Load":"XX","Feature":"XX","Type":"XX"},
               "NextBus3":{"OriginCode":"XX","DestinationCode":"XX","EstimatedArrival":"XX","Latitude":"XX","Longitude":"XX","VisitNumber":"XX","Load":"XX","Feature":"XX","Type":"XX"}}, ...],
 "isAPIKeyValid: XX"}

Single bus arrival timings at a single bus stop

https://sgcommute-287703.appspot.com/busstops/{busStopNumber}/{busServiceNumber} where busStopNumber=01012 and busServiceNumber=12 for bus 12 at bus stop 01012

Response:

{"totalBuses": XX,
 "Services": [{"ServiceNo":"XX",
               "Operator":"XX",
               "NextBus":{"OriginCode":"XX","DestinationCode":"XX","EstimatedArrival":"XX","Latitude":"XX","Longitude":"XX","VisitNumber":"XX","Load":"XX","Feature":"XX","Type":"XX"},
               "NextBus2":{"OriginCode":"XX","DestinationCode":"XX","EstimatedArrival":"XX","Latitude":"XX","Longitude":"XX","VisitNumber":"XX","Load":"XX","Feature":"XX","Type":"XX"},
               "NextBus3":{"OriginCode":"XX","DestinationCode":"XX","EstimatedArrival":"XX","Latitude":"XX","Longitude":"XX","VisitNumber":"XX","Load":"XX","Feature":"XX","Type":"XX"}}],
 "isAPIKeyValid: XX"}