Contoh Notifikasi Layanan

Contoh berikut adalah bentuk ASCII untuk feed Notifikasi Layanan. Dalam contoh ini, notifikasi diterapkan ke semua perjalanan yang melewati perhentian 16230 dan ke perjalanan yang termasuk dalam rute 219 dan mengunjungi perhentian 16130.

Untuk mengetahui detail selengkapnya tentang cara membuat feed Notifikasi Layanan, lihat Ringkasan notifikasi.

# header information
header {
  # version of speed specification. Currently "2.0".
  gtfs_realtime_version: "2.0"

  # DIFFERENTIAL is unsupported. use FULL_DATASET only
  incrementality: FULL_DATASET

  # the moment where this dataset was generated on the server
  timestamp: 1658283241
}
# multiple entities can be included in the feed
entity {
  # unique identifier for the entity within the feed
  id: "0"

  # "type" of the entity
  alert {
    # multiple periods can be defined. active_period defines 
    # the time period that the alert is applied to the selectors
    active_period {
      # either start time or end time must be present
      # one of them can be omitted but not both
      # start time in seconds after epoch
      start: 1658283241
      # end time in seconds after epoch
      end: 1658293845
    }

    # multiple selectors can be given to select the affected entities
    # selectors are applied with a logical OR relationship across 
    # informed_entity messages along with a logical AND relationship 
    # for parameters in each informed_entity
    informed_entity {
      # valid parameters:
      # agency_id, route_id, route_type, direction_id, stop_id, trip
      route_id: "219"
      stop_id: "16130"
    }
    informed_entity {
      stop_id: "16230"
    }

    # system may use the cause and effect to judge the alert severity
    # see https://support.google.com/transitpartners/answer/10104458
    # cause of the alert - see gtfs-realtime.proto for valid values
    cause: CONSTRUCTION
    # effect of the alert - see gtfs-realtime.proto for valid values
    effect: DETOUR

    # the given url provides additional information
    url {
      # multiple languages/translations supported
      translation {
        # the link points to a webpage with more details of the alert
        text: "http://www.sometransitagency/alerts"
        # language code must be BCP-47, if defined
        language: "en"
      }
    }

    # header of the alert
    header_text {
      # multiple languages/translations supported
      translation {
        text: "Stop at Elm street is closed, temporary stop at Oak street"
        language: "en"
      }
    }

    # alert description. additional info to the header text
    description_text {
      # multiple languages/translations supported
      translation {
        text: "Due to construction at Elm street the stop is closed. The temporary stop can be found 300 meters north at Oak street"
        language: "en"
      }
    }
  }
}