SMRT

Description

This API provides real-time next bus arrival time for any given bus stop number, as well as other helpful methods. The API is provided exclusively for the period of the UP Singapore festival.

Source

SMRT

SMRT API

Note from data provider: Transmission of arrival information may be subject to delays.

Standards

$base_url = 'http://54.251.58.124';

GET Requests

You pass in your arguments using GET, and you will receive your result in JSON format.

Accepts one additional argument, callback, which will give the name of the function to wrap the data around with.

Methods

Get Bus Timing

$base_url.'/api/get_bus_timing?bus_stop_number=x'

Replace x with the Bus Service number, and y with the Bus Stop number

Sample URL
http://54.251.58.124/api/get_bus_timing?bus_service_number=106&bus_stop_number=43179
Sample Response
{
  "result": {
    "destination": "Shenton Way Ter",
    "data": [
      {
        "next_bus_arrival_time": "Arr",
        "next_bus_wheelchair_enabled": false
      },
      {
        "second_bus_arrival_time": "13m",
        "second_bus_wheelchair_enabled": false
      }
    ]
  }
}

Checks if the Bus Stop is in Route of Bus Service

$base_url.'/api/get_bus_stop_in_route?bus_service_number=x&bus_stop_number=y'

Replace x with the Bus Service number, and y with the Bus Stop number

Sample URL
http://54.251.58.124/api/get_bus_stop_in_route?bus_service_number=172&bus_stop_number=44009

returns json object

Sample Response
{
    result:{
        data:true
    }
}

Checks if the Bus Stop is in Route of Bus Service

$base_url.'/api/get_all_bus_service_by_bus_stop?bus_stop_number=x'

Replace x with the Bus Stop number

Sample URL
http://54.251.58.124/api/get_bus_services_by_bus_stop?bus_stop_number=44009
Sample Response
{
    result:{
        data:[
            {
                "bus_service_number:": "172"
            },
            {
                "bus_service_number:": "188"
            },
            {
                "bus_service_number:": "188E"
            }
        ]
    }
}

Gets all Bus Services by SMRT

$base_url.'/api/get_bus_services_list'

Sample URL

http://54.251.58.124/api/get_bus_services_list
Sample Response
{
    result:{
        data:[
            {
                "bus_service_number:": "106"
            },
            {
                "bus_service_number:": "106D"
            },
            {
                "bus_service_number:": "167"
            }
        ]
    }
}

Check if Service operated by SMRT

$base_url.'/api/check_bus_service_number?bus_service_number=x'

Replace x with the Bus Service number

Sample URL
http://54.251.58.124/api/check_bus_service_number?bus_service_number=106
Sample Response
{
    result:{
        data:true
    }
}

Check if service is loop Service

$base_url.'/api/get_direction_no?bus_service_number=x'

Replace x with the Bus Service number

1 Represents loop service, 1,2 Represents having 2 directions

Sample URL
http://54.251.58.124/api/get_direction_number?bus_service_number=106
Sample Response
{
    result:{
        direction:"1,2"
    }
}

Get Bus Start/Stop codes

$base_url.'/api/get_terminal_no?bus_service_number=x'

Replace x with the Bus Service number

Sample Response
{
    result:{
        data:[
            {
                name:"Boon Lay Int 22009",
                bus_stop_code:22009
            },
            {
                name:"Choa Chu Kang Int 44009",
                bus_stop_code:44009
            }
        ]
    }
}

Get All Bus Services with Arrival Times

$base_url.'/api/get_bus_stop_services_timings?bus_stop_number=x'

Replace x with the Bus Stop number

Sample URL
http://54.251.58.124/api/get_bus_stop_services_timings?bus_stop_number=44009
Sample Response
{
  "result": {
    "data": [
      {
        "bus_service_number": "172",
        "destination": "Boon Lay Int",
        "timing_data": [
          {
            "next_bus_arrival_time": "7m",
            "next_bus_wheelchair_enabled": false,
            "next_bus_loading": "0"
          },
          {
            "second_bus_arrival_time": "20m",
            "second_bus_wheelchair_enabled": false,
            "second_bus_loading": "0"
          }
        ]
      },
      {
        "bus_service_number": "188",
        "destination": "HarbourFront Int",
        "timing_data": [
          {
            "next_bus_arrival_time": "3m",
            "next_bus_wheelchair_enabled": false,
            "next_bus_loading": "0"
          },
          {
            "second_bus_arrival_time": "19m",
            "second_bus_wheelchair_enabled": false,
            "second_bus_loading": "0"
          }
        ]
      }
    ]
  }
}