GTFS-R API Key

138 views
Skip to first unread message

Stephen McBride

unread,
Aug 26, 2020, 5:22:31 PM8/26/20
to onebusaway-users
Hi there - the transit agency in my country (Ireland) is removing their custom realtime API in favour of a GTFS-R feed. However this new GTFS-R feed requires that an API key header is added to all requests to prevent abuse of the service. I've been looking at deploying my own OBA server to serve my app but there doesn't seem to be an ability to add the required header in the trip update configuration.

What would be the best away to go about adapting OBA to add this header? I'm guessing I would need to modify the source code?

Thanks

Sheldon A. Brown

unread,
Aug 27, 2020, 7:31:28 AM8/27/20
to onebusaw...@googlegroups.com
It's not documented, but a developer contribution a few years ago
quietly added support for this:

https://github.com/OneBusAway/onebusaway-application-modules/blob/master/onebusaway-transit-data-federation/src/main/java/org/onebusaway/transit_data_federation/impl/realtime/gtfs_realtime/GtfsRealtimeSource.java#L130

To use it, try something like this in your
onebusaway-transit-data-federation-webapp data-sources.xml:

<bean class="org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeSource">
<property name="tripUpdatesUrl" value="http://gtfsrt//tripUpdates" />
<property name="vehiclePositionsUrl"
value="http://gtfsrt/vehiclePositions" />
<property name="alertsUrl" value="http://localhost/alerts" />
<property name="refreshInterval" value="30" />
<property name="agencyIds">
<list>
<value>1</value>
</list>
</property>
<property name="headersMap">
<map>
<entry key="x-hello" value="say-hi"/>
</map>
</property>
</bean>


Good luck!

Sheldon
> --
> You received this message because you are subscribed to the Google Groups "onebusaway-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to onebusaway-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/onebusaway-users/bbd4b7de-086b-42f1-974e-5cf17cd1621bn%40googlegroups.com.

cdmein

unread,
Aug 27, 2020, 11:23:08 PM8/27/20
to onebusaway-users
Hi Stephen

Sorry to be off topic but I just wanted to reach out about real time services in Ireland. Pre-Covid we had thought that a OneBusAway type service might be really suitable for the smaller towns and cities in Ireland as it appeared that only Dublin had a system. It sounds like you are working in this area as well - would love to get in touch.

Regards

Chris Mein

Stephen McBride

unread,
Aug 28, 2020, 4:28:28 AM8/28/20
to onebusaway-users
@sheldonabrown - thanks for the tip, much appreciated!

@cdmein sure thing, I'll drop you an email.

Reply all
Reply to author
Forward
0 new messages