Public Transit API Developer's Guide

Real-Time Transit Alerts

User Story

The user wants to obtain detailed information about possible public transit alerts or other announcements from an external source, such as Twitter, in their location (13.3846396, 52.5523361).

Note: Transit Alerts are sourced from API feeds of transit agencies and/or Twitter accounts where available. If the alerts' origin is from Twitter, you are required to follow Twitter's requirements for presenting alerts correctly. HERE does not provide any data for Twitter's logo and links to Twitter's actions. Refer to Twitter Display Requirements for detailed information.

Request

The query parameter center specifies the location of the search. The max parameter limits the number of transit alerts to 10.

https://cit.transit.api.here.com/v3/alerts/nearby.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&max=10
&center=52.5523361,13.3846396

Response

The response to the request contains the following information blocks:
  • a maximum of 40 transit alerts by default, can be configured using the optional max parameter
  • each transit alert includes the following information:
    • origin of the alert, for example Twitter
    • name of the transit operator
    • validity of the alert – date and time
    • related transit lines, if available
{
  "Res": {
    "serviceUrl": "http://search.st.transit.api.here.com/t0k2/tfa",
    "Alerts": {
      "Alert": [
        {
          "id": "836896869221564416-ZGUuYmVybGluLnNiYWhu",
          "operator": "S-Bahn",
          "origin": "TWITTER",
          "valid_from": "2017-03-01T12:12:17",
          "info": "#S5: Der Feuerwehreinsatz in #Hegerm\u00fchle ist beendet. Die Z\u00fcge fahren wieder durchgehend von und nach #Strausberg_Nord",
          "Link": {
            "href": "http://twitter.com/166866601/status/836896869221564416",
            "type": "alert",
            "text": "http://twitter.com/166866601/status/836896869221564416"
          },
          "Transports": {
            "Transport": [
              {
                "name": "S5",
                "mode": 4
              }
            ]
          },
          "Branding": {
            "At": {
              "tweetAvatar": "http://pbs.twimg.com/profile_images/712277313434554368/vun0iQtK_normal.jpg",
              "tweetFullName": "S-Bahn Berlin",
              "tweetId": "836896869221564416",
              "tweetTime": "2017-03-01T12:12:17",
              "tweetUser": "@SBahnBerlin"
            }
          }
        },
        {
          "id": "836877425636167681-ZGUuYmVybGluLnNiYWhu",
          "operator": "S-Bahn",
          "origin": "TWITTER",
          "valid_from": "2017-03-01T10:55:01",
          "info": "Update zur #S5: Es finden notwendige Baumf\u00e4llarbeiten statt.Infos zum SEV: https://t.co/v3p9Jnsxt5 https://t.co/oW3xJnjFTw",
          "Link": {
            "href": "http://twitter.com/166866601/status/836877425636167681",
            "type": "alert",
            "text": "http://twitter.com/166866601/status/836877425636167681"
          },
          "Transports": {
            "Transport": [
              {
                "name": "S5",
                "mode": 4
              }
            ]
          },
          "Branding": {
            "At": {
              "tweetAvatar": "http://pbs.twimg.com/profile_images/712277313434554368/vun0iQtK_normal.jpg",
              "tweetFullName": "S-Bahn Berlin",
              "tweetId": "836877425636167681",
              "tweetTime": "2017-03-01T10:55:01",
              "tweetUser": "@SBahnBerlin"
            }
          }
        },
        {
          "id": "836877422695854080-ZGUuYmVybGluLnNiYWhu",
          "operator": "S-Bahn",
          "origin": "TWITTER",
          "valid_from": "2017-03-01T10:55:00",
          "info": "#S5: Feuerwehreinsatz in #Hegerm\u00fchle. Zugverkehr ist zwischen #Strausberg <> #Strausberg_Nord unterbrochen. SEV ist eingerichtet.",
          "Link": {
            "href": "http://twitter.com/166866601/status/836877422695854080",
            "type": "alert",
            "text": "http://twitter.com/166866601/status/836877422695854080"
          },
          "Transports": {
            "Transport": [
              {
                "name": "S5",
                "mode": 4
              }
            ]
          },
          "Branding": {
            "At": {
              "tweetAvatar": "http://pbs.twimg.com/profile_images/712277313434554368/vun0iQtK_normal.jpg",
              "tweetFullName": "S-Bahn Berlin",
              "tweetId": "836877422695854080",
              "tweetTime": "2017-03-01T10:55:00",
              "tweetUser": "@SBahnBerlin"
            }
          }
        },
        {
          "id": "836850499659919361-ZGUuYmVybGluLnNiYWhu",
          "operator": "S-Bahn",
          "origin": "TWITTER",
          "valid_from": "2017-03-01T09:08:01",
          "info": "#S25: Polizeieinsatz in #Ostdorfer Str. ist beendet. Z\u00fcge verkehren wieder durchgehend. Bitte noch mit Versp\u00e4tungen und Ausf\u00e4llen rechnen.",
          "Link": {
            "href": "http://twitter.com/166866601/status/836850499659919361",
            "type": "alert",
            "text": "http://twitter.com/166866601/status/836850499659919361"
          },
          "Transports": {
            "Transport": [
              {
                "name": "S25",
                "mode": 4
              }
            ]
          },
          "Branding": {
            "At": {
              "tweetAvatar": "http://pbs.twimg.com/profile_images/712277313434554368/vun0iQtK_normal.jpg",
              "tweetFullName": "S-Bahn Berlin",
              "tweetId": "836850499659919361",
              "tweetTime": "2017-03-01T09:08:01",
              "tweetUser": "@SBahnBerlin"
            }
          }
        }
      ]
    }
  }
}