Skip to content

πŸš‡ Simple API, parses MTA's XML, returns JSON for train status.

Notifications You must be signed in to change notification settings

johnrbell/mta_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTA API

Setup

  1. Install gems:

    bundle install
    
  2. Start the server:

    rackup
    

Usage

Request a single train:.

GET: /api/v1/trains/L

{
    "train":"L",
    "status":"DELAYS"
}

You can requst the detailed status of the train with the long=true param. By default it is false.

This detailed response is kinda shitty. Accepting pull requests for whoever wants to attempt cleaning it up.

GET: api/v1/trains/L?long=true

{
  "train":"C",
  "status":"DELAYS",
  "detail":"Delays Posted: 08/18/2016 6:09PM Due to an earlier incident at Jackson Hts-Roosevelt Av, [E] and [F] service has resumed with residual delays. "
}

or you can get all the trains:

GET /api/v1/trains

[
  {
    "train": "1",
    "status": "SERVICE CHANGE"
  },
  {
    "train": "2",
    "status": "SERVICE CHANGE"
  },
  {
    "train": "3",
    "status": "SERVICE CHANGE"
  },
  {
    "train": "4",
    "status": "GOOD SERVICE"
  },
  {
    "train": "5",
    "status": "GOOD SERVICE"
  },
  {
    "train": "6",
    "status": "GOOD SERVICE"
  },
  {
    "train": "7",
    "status": "GOOD SERVICE"
  },
  {
    "train": "A",
    "status": "GOOD SERVICE"
  },
  {
    "train": "C",
    "status": "GOOD SERVICE"
  },
  {
    "train": "E",
    "status": "GOOD SERVICE"
  },
  {
    "train": "B",
    "status": "GOOD SERVICE"
  },
  {
    "train": "D",
    "status": "GOOD SERVICE"
  },
  {
    "train": "F",
    "status": "GOOD SERVICE"
  },
  {
    "train": "M",
    "status": "GOOD SERVICE"
  },
  {
    "train": "G",
    "status": "GOOD SERVICE"
  },
  {
    "train": "J",
    "status": "SERVICE CHANGE"
  },
  {
    "train": "Z",
    "status": "SERVICE CHANGE"
  },
  {
    "train": "L",
    "status": "DELAYS"
  },
  {
    "train": "N",
    "status": "GOOD SERVICE"
  },
  {
    "train": "Q",
    "status": "GOOD SERVICE"
  },
  {
    "train": "R",
    "status": "GOOD SERVICE"
  },
  {
    "train": "S",
    "status": "GOOD SERVICE"
  }
]

About

πŸš‡ Simple API, parses MTA's XML, returns JSON for train status.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages