Skip to content

ETA Transit API

ciolt edited this page Feb 23, 2019 · 3 revisions

ETASpot REST API Reference

All valid responses should return plain JSON. Ensure your code handles errors properly in the case that another type of response is returned.

Basics

API Endpoint

This varies depending on the serviced agency.

http://trirailpublic.etaspot.net/service.php

Authentication

A token parameter is sent containing an API key. For public transit data, use the value TESTING. This parameter may sometimes be optional, but itโ€™s recommended to always add it.

Calling Methods

Everything is sent as parameters to the endpoint. They are serialized into a query string for GET requests.

?service=get_vehicles&token=TESTING

Services API

Each method is called by setting the service parameter to the method name.

get_vehicles

Returns a JSON object containing an array of all tracked vehicles, which may also include vehicles not currently running.

Parameters

Name Required Description Example
equipmentID optional The equipmentID of a vehicle, used for tracking a single vehicle 502
includeETAData optional If set to 1, a minutesToNextStops property will be added to each vehicle containing an array of trip update objects. Setting to -1 does not return any trip updates -1
minutesToNextStops optional If set to 1, the minutesToNextStops property will have a sorted array 1

Example Request

GET http://trirailpublic.etaspot.net/service.php?service=get_vehicles&includeETAData=1&orderedETAArray=1&token=TESTING

Example Response

{
  "get_vehicles": [
    {
      "aID": "354676050503",
      "blockID": 0,
      "capacity": 100,
      "deadHead": "0",
      "direction": "South",
      "directionAbbr": "S.",
      "equipmentID": "503",
      "inService": 1,
      "lat": 25.9222,
      "lng": -80.21625,
      "load": 0,
      "minutesToNextStops": [
        {
          "blockID": 0,
          "direction": "South",
          "directionAbbr": "S.",
          "equipmentID": "503",
          "minutes": 1,
          "patternStopID": "32",
          "routeID": 1,
          "schedule": "01:20PM",
          "scheduleNumber": "P673",
          "status": "On Time",
          "statuscolor": "#39b139",
          "stopID": "14",
          "time": "01:19PM",
          "track": 1
        },
        {
          "blockID": 0,
          "direction": "South",
          "directionAbbr": "S.",
          "equipmentID": "503",
          "minutes": 31,
          "patternStopID": "36",
          "routeID": 1,
          "schedule": "01:50PM",
          "scheduleNumber": "P673",
          "status": "On Time",
          "statuscolor": "#39b139",
          "stopID": "18",
          "time": "01:49PM",
          "track": 2
        }
      ],
      "nextPatternStopID": 32,
      "nextStopETA": 800,
      "nextStopID": 14,
      "onSchedule": 0,
      "patternID": 1,
      "receiveTime": 1550945942000,
      "routeID": 1,
      "scheduleNumber": "P673",
      "trainID": 190,
      "tripID": "P673",
      "vehicleType": "Train"
    }
  ]
}

get_service_announcements

Returns a JSON object containing an array of service alerts.

Example Request

GET http://cgpublic.etaspot.net/service.php?service=get_service_announcements&token=TESTING

Example Response

{
  "get_service_announcements": []
}

get_routes

Returns a JSON object containing an array of route objects.

Example Request

GET http://trirailpublic.etaspot.net/service.php?service=get_routes&token=TESTING

Example Response

{
  "get_routes": [{
    "abbr": "TR",
    "color": "#006c86",
    "encLine": "qgm|C`mzhNuONcGLmJLgYNoRNmEH}HBeYVyOBiHFoIL}JJcdA|@cw@l@sF@_DDaE?S@CD@BQCiAAwVPyX\\aNLubD`Buj@V}IMyI_BaIuDqGcGuE_I_qAodD}QkZwj@as@[WAD@AOUuDcFeTmXoR_V{IcL}Vi[gYm^cqAy`BiL_OcKoOeVy^iIqK{KyG}M{BwNFks@|@eRPak@r@seBlBga@NuULEADKG?e@FsBD{f@\\aLL_aAl@B?BEuBDcv@b@aIIoIi@sWmBsMiAuk@cEsOeAaCQk@I@B?E?B[CsGe@_GI{F\\_NdCwFjAwXnK}JlB}ZtEoM\\aM{A_MqBcMe@yL@kWRqVJmg@Z_K@wJPsJJcj@\\cKBBI@@@QEF]JmBDgYNka@ZkJL{WPiMD{^TmPSuPoDqhAs_@w_C{w@kRqEyf@qG}y@{KsDa@DR@ACCc@MiB[kd@uGeuB}X}vBeY_ScC}f@uGcaBoTsFu@@AiNgBa~A}SqHmAuH{AqTaFqy@yQ}dAuU@BB?wM}CmH_BsIaBuI{@oIQqhFvBgRF}Q?cQ}CqNuI{K_M}d@}h@gy@}~@?BBDA?DEA@GCmWaZkH_IeYwMkOq@{b@NmoAT}z@FcrBb@aM?uA@SBFB?AB?EAw@AySBwTPkTFmJCgKeAu{GgfBqPoCiPg@uOx@oOrA{OT_b@^mPG}OsBg_AyNiIkA{FYcEGeEAF??@AAEBYC}NKcgBaAcRIcoAo@cSQ{z@e@ivAaB_A??E@@BC?B_@@}AAel@u@_I]cIa@kI[{IDyv@dEwOv@oOq@yNmBuN\\iNzCaOrB}a@nE_RbAwRe@k{@gD{RS{v@@yJe@wIoDkGyGsFeHoOsQaIcFgJiBkTg@kFNcFp@kFJ_J?aDRqDXsLGL@NIE@m@?sBEiDe@gDUgDCqDBoDFsDP}`A~HoXtBwlA|CgK`@oJpBgIpEyFjGgOfWkApBeCtEgNzU",
    "id": 1,
    "name": "Tri-Rail",
    "order": 1,
    "showDirection": true,
    "showPlatform": true,
    "showScheduleNumber": 1,
    "showVehicleCapacity": false,
    "stops": [1, 18, 2, 17, 3, 16, 4, 15, 5, 14, 6, 13, 7, 12, 8, 11, 9, 10],
    "type": "Inbound",
    "vType": "Train"
  }]
}

get_patterns

Returns a JSON object containing an array of pattern objects. This endpoint contains information on route lengths (distance-wise in miles)

Example Request

GET http://trirailpublic.etaspot.net/service.php?service=get_patterns&token=TESTING

Example Response

{
  "get_patterns": [{
    "color": "#2E3191",
    "decLine": [],
    "encLine": "qgm|C`mzhNuONcGLmJLgYNoRNmEH}HBeYVyOBiHFoIL}JJcdA|@cw@l@sF@_DDuE@}ABwVPyX\\aNLubD`Buj@V}IMyI_BaIuDqGcGuE_I_qAodD}QkZak@es@wEiGeTmXoR_V{IcL}Vi[gYm^cqAy`BiL_OcKoOeVy^iIqKuDsCeFeCgFoAuFk@wNFks@|@eRPak@r@seBlBga@NuULaD?{f@\\aLLmdAl@cv@b@aIIoIi@sWmBsMiAuk@cEsOeAaCQeAKsGe@_GI{F\\_NdCwFjAwXnK}JlB}ZtEoM\\aM{A_MqBcMe@yL@kWRqVJmg@Z_K@wJPsJJcj@\\cKBeD@kXLka@ZkJL{WPiMD{^TmPSuPoDqhAs_@w_C{w@kRqEyf@qG}y@{KsDa@iC[kd@uGeuB}X}vBeY_ScC}f@uGcaBoTsFu@gNiBa~A}SqHmAuH{AqTaFqy@yQ}dAuUqMyCmH_BsIaBuI{@oIQqhFvBgRF}Q?cQ}CqNuI{K_M}d@}h@gy@}~@oW_ZkH_ImKaHwLuDkOq@{b@NmoAT}z@FcrBb@aM?iBBkUBwTPkTFmJCgKeAu{GgfBqPoCiPg@uOx@oOrA{OT_b@^mPG}OsBg_AyNiIkA{FYcEG_FA}NKcgBaAcRIcoAo@cSQ{z@e@ivAaBwDCel@u@_I]cIa@kI[{IDyv@dEwOv@qGK}Fe@yNmBoFKeGh@iNzCaOrB}a@nE_RbAwRe@k{@gD{RS{v@@yJe@{DoA{C_BkGyGsFeHoOsQaIcFgJiBkTg@kFNcFp@kFJ_J?aDRqDXsLGiCKeDi@{AOoAAgDCqDBoDFsDP}`A~HoXtBwlA|CgK`@oJpBgIpEyFjGgOfWkApBeCtEaLrR",
    "extID": "1",
    "id": 1,
    "length": 75,
    "name": "Northbound",
    "routeNames": ["Tri-Rail"],
    "routes": [1],
    "stations": [],
    "type": 1
  }]
}

get_stops

Returns a JSON object containing an array of stop objects. The stop objects are not all unique, some overlap. Each stopโ€™s unique identifier is in the id property, which can be used to merge together stop information. Exact stop locations may vary even for those with the same id, make sure to be aware of this.

Parameters

Name Required Description Example
stopIDs optional A comma-delimited list of stop IDs. If set, it returns only the stops which match this same ID instead of all stops. 2,5,3

Example Request

GET http://trirailpublic.etaspot.net/service.php?service=get_stops&stopIDs=2&token=TESTING

Example Response

{
  "get_stops": [
    {
      "rid": 1,
      "id": 2,
      "name": "West Palm Beach Station",
      "lat": 26.713298797607,
      "lng": -80.062538146973,
      "extID": "",
      "shortName": "WPB"
    },
    {
      "rid": 51,
      "id": 2,
      "name": "West Palm Beach Station",
      "lat": 26.712093353271,
      "lng": -80.062118530273,
      "extID": "2",
      "shortName": "2"
    }
  ]
}

get_stopimages

Returns a JSON object containing an array of stop info objects. Generally, only major stations will be returned. Images array may sometimes contain blank or null values. The amenities property contains a comma-delimited list.

Parameters

Name Required Description Example
stopID optional Numerical stop ID that, if set, only returns data for that stop rather than all stops 8

Example Request

GET http://cgpublic.etaspot.net/service.php?service=get_stopimages&token=TESTING

Example Response

{
  "get_stopimages": [
    {
      "amenities": "Lighting,Sidewalk,Stop Sign,Station Signage,Shelter,Information/Schedule/System Map ,Security,Trash Receptacle(s),Enclosed Waiting Areas,Restrooms,Bus Bay / Curb Extension,Park-and-Ride Lot,Bicycle Racks/Parking,Enhanced Passenger Amenities,Information/Commuter Center",
      "comments": "",
      "images": [
        "Content/images/60/0.png",
        "Content/images/60/1.png",
        "Content/images/60/2.png",
        ""
      ],
      "stopid": 27,
      "stoplocdesc": "",
      "type": "Station"
    }
  ]
}