### Get Facilities Maintenance Information (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches information on adhoc lift maintenance in MRT stations. Requires an API key for authentication. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/v2/FacilitiesMaintenance" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Planned Road Openings (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches information on planned road openings, including work schedules. Requires an API key for authentication. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/RoadOpenings" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Taxi Stand Information (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches detailed information about taxi stands, including their location and accessibility features. An API key is required for authentication. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/TaxiStands" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Example API Call with $skip Operator (Bus Routes) Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md This example demonstrates how to retrieve subsequent records from a dataset by appending the $skip operator to the API call URL. This is crucial for pagination when the number of records exceeds the default limit (typically 500). ```url https://datamall2.mytransport.sg/ltaodataservice/BusRoutes?$skip=500 ``` -------------------------------- ### Bus Service Arrival Data Example Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Provides examples of JSON data representing bus arrival information for different services. Each entry details the service number, operator, and estimated arrival times for upcoming buses, including their origin, destination, and monitoring status. ```json { "ServiceNo": "150", "Operator": "SBST", "NextBus": { "OriginCode": "82009", "DestinationCode": "82009", "EstimatedArrival": "2024-08-14T16:55:22+08:00", "Monitored": 0, "Latitude": "0.0", "Longitude": "0.0", "VisitNumber": "1", "Load": "SEA", "Feature": "WAB", "Type": "SD" }, "NextBus2": { "OriginCode": "82009", "DestinationCode": "82009", "EstimatedArrival": "2024-08-14T17:15:22+08:00", "Monitored": 0, "Latitude": "0.0", "Longitude": "0.0", "VisitNumber": "1", "Load": "SEA", "Feature": "WAB", "Type": "SD" }, "NextBus3": { "OriginCode": "", "DestinationCode": "", "EstimatedArrival": "", "Monitored": 0, "Latitude": "", "Longitude": "", "VisitNumber": "", "Load": "", "Feature": "", "Type": "" } }, { "ServiceNo": "155", "Operator": "SBST", "NextBus": { "OriginCode": "52009", "DestinationCode": "84009", "EstimatedArrival": "2024-08-14T16:45:23+08:00", "Monitored": 1, "Latitude": "1.3183185", "Longitude": "103.9003205", "VisitNumber": "1", "Load": "SEA", "Feature": "WAB", "Type": "SD" }, "NextBus2": { "OriginCode": "52009", "DestinationCode": "84009", "EstimatedArrival": "2024-08-14T17:01:38+08:00", "Monitored": 1, "Latitude": "1.3254035", "Longitude": "103.88185066666667", "VisitNumber": "1", "Load": "SEA", "Feature": "WAB", "Type": "SD" }, "NextBus3": { "OriginCode": "52009", "DestinationCode": "84009", "EstimatedArrival": "2024-08-14T17:12:38+08:00", "Monitored": 1, "Latitude": "1.328204666666667", "Longitude": "103.8799955", "VisitNumber": "1", "Load": "SEA", "Feature": "WAB", "Type": "SD" } } ``` -------------------------------- ### Get Traffic Images (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches links to live traffic condition images for expressways and checkpoints. Image links are valid for 5 minutes. The request needs an AccountKey and returns CameraID, coordinates, and the image link. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/Traffic-Imagesv2" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Approved Road Works (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves information on approved road works, both current and planned. An API key is required for authentication. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/RoadWorks" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Train Delay - Service Resumes Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md This example shows the API response after a train delay has been resolved and the service has resumed normal operations. ```APIDOC ## GET /TrainServicesAlerts ### Description Retrieves alerts related to train services. This response indicates that a previously reported train delay has been resolved and the service has resumed. ### Method GET ### Endpoint /TrainServicesAlerts ### Parameters #### Query Parameters - **$filter** (string) - Optional - Filter results based on specific criteria. - **$format** (string) - Optional - Specify the response format (e.g., json, xml). ### Request Example (No specific request example provided for this scenario, standard GET request applies) ### Response #### Success Response (200) - **odata.metadata** (string) - Metadata URL for the response. - **value** (object) - Contains the train service alert details. - **Status** (integer) - Status code indicating the result of the operation (1 for success). - **AffectedSegments** (array) - An empty array indicating no segments are currently affected. - **Message** (array) - An empty array indicating no active alert messages, signifying the delay has ended. #### Response Example ```json { "odata.metadata": "http://datamall2.mytransport.sg/ltaodataservice/$metadata#TrainServicesAlerts", "value": { "Status": 1, "AffectedSegments": [], "Message": [] } } ``` ``` -------------------------------- ### GET /BicycleParkingv2 Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Retrieves bicycle parking locations within a specified radius. The default radius is 0.5km. ```APIDOC ## GET /BicycleParkingv2 ### Description Returns bicycle parking locations within a radius. The default radius is set as 0.5km. ### Method GET ### Endpoint https://datamall2.mytransport.sg/ltaodataservice/BicycleParkingv2 ### Parameters #### Query Parameters - **Lat** (float) - Latitude map coordinates of location. **Required**. - **Long** (float) - Longitude map coordinates of location. **Required**. - **Dist** (float) - Radius in kilometers. *Optional*. Defaults to 0.5. ### Request Example ``` GET https://datamall2.mytransport.sg/ltaodataservice/BicycleParkingv2?Lat=1.364897&Long=103.766094&Dist=1 ``` ### Response #### Success Response (200) - **CarParkID** (string) - Unique identifier for the car park. - **Latitude** (float) - Latitude coordinates of the car park. - **Longitude** (float) - Longitude coordinates of the car park. - **Agency** (string) - The agency managing the car park. - **CarParkType** (string) - Type of car park (e.g., "Bicycle Parking"). - **Area** (string) - The area where the car park is located. - **Development** (string) - Name of the development where the car park is located. - **Location** (string) - A more detailed description of the car park's location. - **Distance** (float) - The distance from the specified location to the car park. #### Response Example ```json { "value": [ { "CarParkID": "XXX", "Latitude": 1.364897, "Longitude": 103.766094, "Agency": "HDB", "CarParkType": "Bicycle Parking", "Area": "Example Area", "Development": "Example Development", "Location": "Near Block XX, Example Street", "Distance": 0.2 } ] } ``` ``` -------------------------------- ### Get Real-time Bus Arrivals - Bash Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches real-time bus arrival information for a specific bus stop and service number. Requires an AccountKey for authentication. Returns estimated arrival times, bus location, and crowding levels. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/v3/BusArrival?BusStopCode=83139&ServiceNo=15" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Bus Services - Bash Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches detailed service information for all operational buses. This includes origin and destination stops, and dispatch frequencies during peak and off-peak hours. Authentication is handled via AccountKey. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/BusServices" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Passenger Volume Data (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves aggregated passenger volume data by bus stops, train stations, or origin-destination pairs. Data is generated monthly and requires an API key. The response is a download link to a CSV file. ```bash # By Bus Stops curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/PV/Bus?Date=201803" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" # By Origin-Destination Bus Stops curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/PV/ODBus?Date=201804" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" # By Train Stations curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/PV/Train?Date=201805" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" # By Origin-Destination Train Stations curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/PV/ODTrain?Date=201803" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Bicycle Parking Locations (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves bicycle parking locations within a specified radius of a given latitude and longitude. Requires an API key for authentication. The default radius is 0.5 km. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/BicycleParkingv2?Lat=1.364897&Long=103.766094&Dist=0.5" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Geospatial Data (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves SHP files for specified geospatial layers such as road infrastructure, train stations, and cycling paths. Requires an API key. The response is a download link to a ZIP file. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/GeospatialWholeIsland?ID=ArrowMarking" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Station Crowd Density Forecast (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches forecasted MRT/LRT station crowdedness levels at 30-minute intervals for a given train line. Requires an AccountKey and TrainLine parameter. Returns date, station, time intervals, and crowd level. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/PCDForecast?TrainLine=NSL" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Bus Routes - Bash Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves detailed route information for all active bus services. This includes bus stops along each route and the timings for the first and last buses. Uses AccountKey for authentication and supports OData pagination with `$skip`. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/BusRoutes?$skip=0" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Generate HTTP GET Request using JavaScript (jQuery) Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md This code snippet, generated from Postman, shows how to make an HTTP GET request to the LTA DataMall API using JavaScript with the jQuery library. It includes necessary headers like 'AccountKey' for authentication and targets the 'TrafficSpeedBandsv2' endpoint. ```javascript var settings = { "async": true, "crossDomain": true, "url": "http://datamall2.mytransport.sg/ltaodataservice/TrafficSpeedBandsv2", "method": "GET", "headers": { "AccountKey": "YOUR_ACCOUNT_KEY", "accept": "application/json" } } ``` -------------------------------- ### GET /PV/Bus Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Retrieves passenger volume data by bus stops, including tap-in and tap-out counts for weekdays and weekends. ```APIDOC ## GET /PV/Bus ### Description Returns tap in and tap out passenger volume by weekdays and weekends for individual bus stop. ### Method GET ### Endpoint https://datamall2.mytransport.sg/ltaodataservice/PV/Bus ### Parameters #### Query Parameters - **Date** (string) - Optional - Request for files up to last three months. Format: YYYYMM (e.g., 201803). - **$skip** (integer) - Optional - Skip the specified number of records in the response. - **$top** (integer) - Optional - Return only the specified number of records in the response. - **count** (boolean) - Optional - Include the total number of records in the response. - **format** (string) - Optional - Specifies the response format (e.g., json, xml). Defaults to json. ### Request Example ```json { "example": "GET https://datamall2.mytransport.sg/ltaodataservice/PV/Bus?Date=201803&$top=5" } ``` ### Response #### Success Response (200) - **Link** (string) - URL to download the passenger volume data file. The link expires after 5 minutes. #### Response Example ```json { "value": [ { "Link": "https://ltafarecard.s3.amazonas.com/201803/transport_node_bus_201803.zip?x-amz-security-token=..." } ] } ``` ``` -------------------------------- ### Train Service Alert - No New Messages Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md This example shows the response when bus rides are ceased and there are no new published messages, indicating the resolution of a disruption. ```APIDOC ## GET /TrainServicesAlerts (No New Messages) ### Description Represents the state after bus rides are ceased and no new messages are published, indicating the end of a service disruption. ### Method GET ### Endpoint /TrainServicesAlerts ### Response #### Success Response (200) - **odata.metadata** (string) - Metadata URL. - **value** (object) - Contains the status, affected segments, and messages. - **Status** (integer) - The status code of the service alert (typically 1 if resolved). - **AffectedSegments** (array) - An empty array, indicating no segments are currently affected. - **Message** (array) - An empty array, indicating no active messages. #### Response Example ```json { "odata.metadata": "http://datamall2.mytransport.sg/ltaodataservice/$metadata#TrainServicesAlerts", "value": { "Status": 1, "AffectedSegments": [], "Message": [] } } ``` ``` -------------------------------- ### Traffic Incidents API Response Example Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md This section shows an example of a JSON response for the Traffic Incidents dataset. It includes details like 'Type', 'Latitude', 'Longitude', and 'Message' for each incident. ```APIDOC ## GET /TrafficIncidents ### Description Retrieves traffic incident data from the LTA DataMall. ### Method GET ### Endpoint https://datamall2.mytransport.sg/ltaodataservice/IncidentSet ### Parameters #### Query Parameters - **$skip** (integer) - Optional - Skips the specified number of records. Used for pagination. ### Request Example ``` https://datamall2.mytransport.sg/ltaodataservice/IncidentSet?$skip=500 ``` ### Response #### Success Response (200) - **odata.metadata** (string) - Metadata URL for the dataset. - **value** (array) - An array of incident objects. - **Type** (string) - The type of incident (e.g., Roadwork). - **Latitude** (number) - The latitude coordinate of the incident. - **Longitude** (number) - The longitude coordinate of the incident. - **Message** (string) - A descriptive message about the incident. #### Response Example ```json { "odata.metadata": "http://datamall2.mytransport.sg/ltaodataservice/$metadata#IncidentSet", "value": [ { "Type": "Roadwork", "Latitude": 1.349079923951095, "Longitude": 103.96381753388967, "Message": "(5/4)15:34 Roadworks on PIE (towards Tuas) at Upper Changi Rd East(South) Entrance." }, { "Type": "Roadwork", "Latitude": 1.2692727102347006, "Longitude": 103.82515548535012, "Message": "(5/4)15:18 Roadworks on Kampong Bahru Road (towards Mount Faber Road) after Telok Blangah Road. Avoid right lane." } ] } ``` ``` -------------------------------- ### GET /BusStops Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Retrieves detailed information for all active bus stops, including their codes, road names, landmarks, and geographical coordinates. ```APIDOC ## GET /BusStops ### Description Returns detailed information for all bus stops currently being serviced by buses, including: Bus Stop Code, location coordinates. ### Method GET ### Endpoint https://datamall2.mytransport.sg/ltaodataservice/BusStops ### Parameters #### Query Parameters - **$skip** (integer) - Optional - Skip the specified number of records in the response. - **$top** (integer) - Optional - Return only the specified number of records in the response. - **count** (boolean) - Optional - Include the total number of records in the response. - **format** (string) - Optional - Specifies the response format (e.g., json, xml). Defaults to json. ### Request Example ```json { "example": "GET https://datamall2.mytransport.sg/ltaodataservice/BusStops?$top=10" } ``` ### Response #### Success Response (200) - **BusStopCode** (string) - The unique 5-digit identifier for this physical bus stop - **RoadName** (string) - The road on which this bus stop is located - **Description** (string) - Landmarks next to the bus stop (if any) to aid in identifying this bus stop - **Latitude** (number) - Location coordinates for this bus stop - **Longitude** (number) - Location coordinates for this bus stop #### Response Example ```json { "value": [ { "BusStopCode": "01012", "RoadName": "Victoria St", "Description": "Hotel Grand Pacific", "Latitude": 1.29685, "Longitude": 103.853 } ] } ``` ``` -------------------------------- ### Get Train Service Alerts Response (JSON) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Example JSON response structure for the Train Service Alerts API, detailing the status, affected segments, and messages related to train service disruptions. ```json { "odata.metadata": "http://datamall2.mytransport.sg/ltaodataservice/$metadata#TrainServicesAlerts", "value": { "Status": 2, "AffectedSegments": [ { "Line": "NEL", "Direction": "HarbourFront", "Stations": "NE9,NE8,NE7,NE6", "FreePublicBus": "NE9,NE8,NE7,NE6", "FreeMRTShuttle": "NE9,NE8,NE7,NE6", "MRTShuttleDirection": "HarbourFront" } ], "Message": [ { "Content": "1711hrs : NEL - Additional travelling time of 40 minutes between Boon Keng and Dhoby Ghaut stations towards HarbourFront station due to a signal fault. Free bus rides available at designated stops towards HarbourFront station.", "CreatedDate": "2017-12-11 17:11:27" } ] } } ``` -------------------------------- ### Get EV Charging Points using cURL Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches electric vehicle charging points and their real-time availability status in Singapore using an HTTP GET request. Requires an AccountKey for authentication. The response includes details like address, status, and charging point information. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/EVChargingPoints?PostalCode=123456" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Bus Arrival API Call and Response Example Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Demonstrates a sample API call to retrieve bus arrival information for a specific bus stop code and its corresponding JSON response. The response includes details about the bus service number, operator, and estimated arrival times for the next three buses. ```json { "odata.metadata": "https://datamall2.mytransport.sg/ltaodataservice/v3/BusArrival", "BusStopCode": "83139", "Services": [ { "ServiceNo": "15", "Operator": "GAS", "NextBus": { "OriginCode": "77009", "DestinationCode": "77009", "EstimatedArrival": "2024-08-14T16:41:48+08:00", "Monitored": 1, "Latitude": "1.3154918333333334", "Longitude": "103.9059125", "VisitNumber": "1", "Load": "SEA", "Feature": "WAB", "Type": "SD" }, "NextBus2": { "OriginCode": "77009", "DestinationCode": "77009", "EstimatedArrival": "2024-08-14T16:49:22+08:00", "Monitored": 1, "Latitude": "1.3309621666666667", "Longitude": "103.9034135", "VisitNumber": "1", "Load": "SEA", "Feature": "WAB", "Type": "SD" }, "NextBus3": { "OriginCode": "77009", "DestinationCode": "77009", "EstimatedArrival": "2024-08-14T17:06:11+08:00", "Monitored": 1, "Latitude": "1.344761", "Longitude": "103.94022316666667", "VisitNumber": "1", "Load": "SEA", "Feature": "WAB", "Type": "SD" } } ] } ``` -------------------------------- ### API Pagination using $skip Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Explains how to retrieve subsequent records from API calls by using the '$skip' operator in the URL. Each call is limited to 500 records. ```APIDOC ## API Pagination ### Description To retrieve subsequent records of a dataset, append the `$skip` operator to the API call URL. Each API call returns a maximum of 500 records. ### Method GET ### Endpoint `https://datamall2.mytransport.sg/ltaodataservice/[DatasetName]` ### Parameters #### Query Parameters - **$skip** (integer) - Required - Specifies the number of records to skip from the beginning of the dataset. Used for pagination. ### Request Example To retrieve records 501-1000: ``` https://datamall2.mytransport.sg/ltaodataservice/BusRoutes?$skip=500 ``` To retrieve records 1001-1500: ``` https://datamall2.mytransport.sg/ltaodataservice/BusRoutes?$skip=1000 ``` ### Response #### Success Response (200) - Returns a JSON object containing up to 500 records of the specified dataset. #### Response Example (See Traffic Incidents API Response Example for structure) ### Notes - Each URL call returns a maximum of 500 records. - The `$skip` operator can be used to paginate through large datasets. ``` -------------------------------- ### Get VMS / EMAS Advisories (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves traffic advisories displayed on EMAS signboards along expressways and arterial roads. An API key is required for authentication. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/VMS" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Bus Arrival API Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Returns real-time Bus Arrival information for Bus Services at a queried Bus Stop. Includes Estimated Time of Arrival (ETA), Estimated Location, and Load info. ```APIDOC ## GET /busarrival ### Description Retrieves real-time bus arrival information for a specific bus stop, including estimated arrival times, current bus location, and passenger load. ### Method GET ### Endpoint /busarrival ### Parameters #### Query Parameters - **BusStopCode** (string) - Required - The code of the bus stop to query. - **ServiceNo** (string) - Optional - The bus service number to filter by. ### Request Example ```json { "example": "GET /busarrival?BusStopCode=12345&ServiceNo=10" } ``` ### Response #### Success Response (200) - **BusStopCode** (string) - The code of the bus stop. - **ServiceNo** (string) - The bus service number. - **NextBus** (object) - Information about the next bus. - **EstimatedArrival** (string) - The estimated time of arrival. - **Latitude** (string) - The latitude of the bus. - **Longitude** (string) - The longitude of the bus. - **Load** (string) - The passenger load on the bus. - **SubsequentBus** (object) - Information about the subsequent bus. - **EstimatedArrival** (string) - The estimated time of arrival. - **Latitude** (string) - The latitude of the bus. - **Longitude** (string) - The longitude of the bus. - **Load** (string) - The passenger load on the bus. #### Response Example ```json { "example": { "BusStopCode": "12345", "ServiceNo": "10", "NextBus": { "EstimatedArrival": "2023-10-27T10:30:00+08:00", "Latitude": "1.23456", "Longitude": "103.12345", "Load": "Seats Available" }, "SubsequentBus": { "EstimatedArrival": "2023-10-27T10:35:00+08:00", "Latitude": "1.23457", "Longitude": "103.12346", "Load": "Slightly Crowded" } } } ``` ``` -------------------------------- ### Get Planned Bus Routes (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches information on planned new or updated bus routes. Data is released on or after the effective date and requires an API key for authentication. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/PlannedBusRoutes" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Train Service Alerts - Free Public Bus Service Ceased Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md This example shows the API response when a train service has recovered and the free public bus service has ceased. ```APIDOC ## GET /TrainServicesAlerts ### Description Retrieves alerts related to train services, including recovery status and free bus service information. ### Method GET ### Endpoint /TrainServicesAlerts ### Parameters #### Query Parameters - **$filter** (string) - Optional - Filter results based on specific criteria. - **$format** (string) - Optional - Specify the response format (e.g., json, xml). ### Request Example ```json { "odata.metadata": "http://datamall2.mytransport.sg/ltaodataservice/$metadata#TrainServicesAlerts", "value": { "Status": 1, "AffectedSegments": [], "Message": [ { "Content": "1827hrs: All train service resume. Free bus rides island-wide have ceased.", "CreatedDate": "2017-12-11 18:27:06" }, { "Content": "1825hrs: All train service resume. Free bus rides are still available island-wide.", "CreatedDate": "2017-12-11 18:25:24" } ] } } ``` ### Response #### Success Response (200) - **odata.metadata** (string) - Metadata URL for the response. - **value** (object) - Contains the train service alert details. - **Status** (integer) - Status code indicating the result of the operation. - **AffectedSegments** (array) - List of segments affected by the disruption. - **Message** (array) - Array of alert messages. - **Content** (string) - The content of the alert message. - **CreatedDate** (string) - The date and time when the message was created. #### Response Example ```json { "odata.metadata": "http://datamall2.mytransport.sg/ltaodataservice/$metadata#TrainServicesAlerts", "value": { "Status": 1, "AffectedSegments": [], "Message": [ { "Content": "1827hrs: All train service resume. Free bus rides island-wide have ceased.", "CreatedDate": "2017-12-11 18:27:06" } ] } } ``` ``` -------------------------------- ### Active Mobility Related API Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md API for retrieving bicycle parking locations. ```APIDOC ## Bicycle Parking API ### Description Returns the bicycle parking locations within a radius. ### Endpoint [Specify endpoint path if available, e.g., GET /bicycle-parking] ### Parameters [Specify parameters if available, e.g., radius (float, optional)] ``` -------------------------------- ### Get Estimated Travel Times (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves estimated travel times in minutes for expressway segments. The request requires an AccountKey and returns details such as expressway name, direction, endpoints, and estimated time. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/EstTravelTimes" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### GET /BusServices Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Retrieves detailed service information for all buses currently in operation. This includes the first stop, last stop, and frequency of dispatch during peak and off-peak hours. ```APIDOC ## GET /BusServices ### Description Returns detailed service information for all buses currently in operation, including: first stop, last stop, peak / offpeak frequency of dispatch. ### Method GET ### Endpoint https://datamall2.mytransport.sg/ltaodataservice/BusServices ### Parameters #### Query Parameters #### Request Body ### Request Example ```json { "example": "No request body for this endpoint." } ``` ### Response #### Success Response (200) - **ServiceNo** (string) - The bus service number - **Operator** (string) - Operator for this bus service - **Direction** (integer) - The direction in which the bus travels (1 or 2), loop services only have 1 direction - **Category** (string) - Category of the SBS bus service: EXPRESS, FEEDER, INDUSTRIAL, TOWNLINK, TRUNK, 2 TIER FLAT FEE, FLAT FEE $1.10 (or $1.90, $3.50, $3.80) - **OriginCode** (string) - Bus stop code for first bus stop - **DestinationCode** (string) - Bus stop code for last bus stop (similar as first stop for loop services) - **AM_Peak_Freq** (string) - Freq of dispatch for AM Peak 0630H - 0830H (range in minutes) - **AM_Offpeak_Freq** (string) - Freq of dispatch for AM Off-Peak 0831H - 1659H (range in minutes) - **PM_Peak_Freq** (string) - Freq of dispatch for PM Peak 1700H - 1900H (range in minutes) - **PM_Offpeak_Freq** (string) - Freq of dispatch for PM Off-Peak after 1900H (range in minutes) - **LoopDesc** (string) - Location at which the bus service loops, empty if not a loop service. #### Response Example ```json { "value": [ { "ServiceNo": "107M", "Operator": "SBST", "Direction": 1, "Category": "TRUNK", "OriginCode": "64009", "DestinationCode": "64009", "AM_Peak_Freq": "14-17", "AM_Offpeak_Freq": "10-16", "PM_Peak_Freq": "12-15", "PM_Offpeak_Freq": "12-15", "LoopDesc": "Raffles Blvd" } ] } ``` ``` -------------------------------- ### Load - Colour Scheme Adoption Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Provides a recommended color scheme to visually indicate the loading status of buses. ```APIDOC ## Load - Colour Scheme Adoption ### Description This section suggests a color scheme for visually representing different bus load levels. Developers can use these colors to indicate the availability of seats and standing space. ### Color Scheme: - **Green:** Seats Available - **Amber:** Standing Available - **Red:** Limited Standing ### Implementation Flexibility: Developers have the flexibility to implement these color indicators in various ways, such as color bars, colored timings, or accompanied by legends, as appropriate for their application. ``` -------------------------------- ### Get Traffic Flow Data (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves hourly average traffic flow data from a representative month each quarter during peak hours. Requires an API key. The response is a download link to a JSON file. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/TrafficFlow" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Passenger Volume Data Sample (Bus) Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Sample output for LTA DataMall API's 'Passenger Volume by Origin Destination Bus Stops'. The data is in a CSV variant format with specific delimiters. It includes year-month, day type, time of hour, transport type, origin, destination, and total trips. ```csv 2018-05, WEEKDAY, 16, BUS, 28299, 28009, 63 2018-05, WEEKENDS/HOLIDAY, 16, BUS, 28299, 28009, 103 ``` -------------------------------- ### Get Taxi Availability (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves the location coordinates of taxis currently available for hire. This endpoint does not return details for hired or busy taxis. It requires an AccountKey and returns up to 500 records per call. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/Taxi-Availability" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Traffic Incidents - Bash Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches real-time traffic incidents occurring on Singapore's roads, such as accidents, breakdowns, or diversions. Requires AccountKey for authentication and provides incident type, location, and a descriptive message. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/TrafficIncidents" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Get Faulty Traffic Lights (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches alerts for faulty or under-maintenance traffic lights. The request requires an AccountKey and returns information including alarm ID, node ID, type of fault, dates, and a message. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/FaultyTrafficLights" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Additional Note on Loop Services Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Clarifies the handling of loop services that run in both directions, often denoted by 'G' or 'W' suffixes. ```APIDOC ## Additional Note on Loop Services ### Description This note addresses specific loop services that operate in two directions. It is important to correctly identify and display these services individually. ### Handling Loop Services: Some Loop Services are appended with **'G'** or **'W'** to denote their direction of travel (e.g., 225G, 225W, 243G, 243W, 410G, 410W). You should account for and display these services individually to ensure accurate information is provided to users. ``` -------------------------------- ### Get Train Service Alerts (Bash) Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Fetches information about train service disruptions during operating hours, including affected lines, stations, and shuttle services. The request requires an AccountKey and returns a JSON object with alert details. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/TrainServiceAlerts" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ``` -------------------------------- ### Estimated Arrival - Advisement Messages Source: https://github.com/rahulkolasseri/lta_datamall_api_user_guide/blob/main/LTA_DataMall_API_User_Guide.md Guidance on displaying advisement messages when bus arrival data is unavailable or when buses are not in operation. It outlines scenarios and recommended messages like 'No Est. Available' and 'Not In Operation'. ```APIDOC ## Estimated Arrival - Advisement Messages ### Description This section provides guidelines for front-end implementation concerning bus arrival data. It details how to display advisement messages when bus arrival data is unavailable, either partially or in full. It also covers scenarios where buses are not in operation based on scheduled operating hours. ### Key Scenarios and Advisement Messages: - **Bus is in operation & Arrival data is available:** No advisement message required. - **Bus is in operation & Arrival data is NOT available:** Display "No Est. Available". - **Bus is NOT in operation & Arrival data is NOT available:** Display "Not In Operation". - **Bus is NOT in operation & Arrival data is available:** No advisement message required. (This can occur before the first bus or after the last bus if they are running behind schedule). ### General Logic: Always display arrival data if available on the API, regardless of scheduled operating hours. Advisement messages are only applicable when there is no arrival data on the API. ``` -------------------------------- ### Get Bus Stops - Bash Source: https://context7.com/rahulkolasseri/lta_datamall_api_user_guide/llms.txt Retrieves comprehensive details for all serviced bus stops. Information includes the unique bus stop code, road name, description, and geographical coordinates (latitude and longitude). Requires AccountKey authentication. ```bash curl -X GET "https://datamall2.mytransport.sg/ltaodataservice/BusStops?$skip=0" \ -H "AccountKey: YOUR_API_KEY" \ -H "accept: application/json" ```