Skip to content
Docs

How to add a data feed?

The recommended way to share data between operators and the dashboard is the MDS /vehicles endpoint. At this moment the dashboard supports version 1.2 of MDS. When implemented by operators version 2.0 (where /vehicles and /vehicle/status is splitted up in two parts) will also be added. Also support for the MDS /trips endpoint will be added in the near future.

The dashboard has deprecated compatibility with GBFS 1.x free_bike_status.json and the TOMP API. We don’t recommend to add new operators with these data feeds anymore, because these standards started focussing on only exchanging data for traveler information. This makes GBFS and TOMP less usable for monitoring purposes.

Authentication

At this moment there is no standard way specified on how the authentication should be done. This leads to a wide variety of authentication methods.

At this moment the dashboard support feeds that are:

  • Not authenticated
  • Authenticated with a static apikey in the header
  • Several OAuth 2.0 implementations (they differ per operator)

If authentication is required we strongly recommend to require static apikeys because it’s the easiest and least error prone option to implement.

How to add an operator?

Adding a new operator consists of 2 steps:

  1. Add at least one feed to the database.
  2. Add operator to frontend

Add feed to database

New data feeds should be added to the feedsdatabase table. Per operator you should define a system_id. If multiple feeds have the same system_id the data is combined when the data if fetched before its further processed.

  • system_id: unique ID per operator
  • feed_url: the https URL to request data from
  • feed_type: one of mds, full_gbfs (when referring to gbfs.json, gbfs (when reffering to free_bike_status.json) and tomp
  • import_strategy: always clean for now
  • authentication: specifies all authentication details as a JSON object.
  • last_time_update: value to track when the feed is changed for the last time.
  • default_vehicle_type: some data standards don’t provide information about what vehicle_types every vehicle is, by setting op a default vehicle_type you can get correct data in most circumstances. Default vehicle_types can be found here
  • request_headers, sometimes additonal HTTP headers are needed to request data. In this column all those headers can be added.
  • is_active: it’s possible to deactivate a feed without removing the record of the feed by setting this value to false.

Examples of adding a feed

Default OAuth2 authentication

This is an example how you can add a MDS /vehicle feed with default OAuth2 authentication:

INSERT INTO feeds (system_id, feed_url, feed_type, import_strategy, authentication, last_time_updated, default_vehicle_type, request_headers, is_active) 
VALUES (
    '<system_id>', 
    '<feed_url>', 
    'mds', 
    'clean', 
    '
    {
        "TokenURL":"<url_to_request_token>",
        "OAuth2Credentials":{
            "client_id":"<client_id>",
            "client_secret":"<client_secret>",
            "scope":"<scope>",
            "grant_type":"client_credentials"
        },
        "authentication_type":"oauth2"
    }
    ', 
    NOW(), 
    4, 
    '
    {
        "Accept": "application/vnd.mds.provider+json;version=1.2"
    }
    ',
    true
);
Without authentication
INSERT INTO feeds (system_id, feed_url, feed_type, import_strategy, last_time_updated, is_active) 
VALUES (
    'dott', 
    'https://gbfs.api.ridedott.com/public/v2/brussels/gbfs.json', 
    'full_gbfs', 
    'clean', 
    NOW(),
    true
);
With static api key
INSERT INTO feeds 
(system_id, feed_url, feed_type, import_strategy, authentication, last_time_updated, default_vehicle_type, request_headers, is_active) 
VALUES (
    '<system_id>', 
    '<feed_url>', 
    'mds', 
    'clean', 
    '{
        "ApiKeyName":"Authorization",
        "ApiKey":"Bearer <token>",
        "authentication_type":"token"
    }   
    ', 
    NOW(), 
    4,
    '
    {
        "Accept": "application/vnd.mds+json;version=1.0"
    }
    ',
    true
);

Add operator to the frontend

  1. One record should be added cPublicAanbieders list in metadataAccessControlList.js
  2. One record should be added to getPrettyProviderName, getProviderWebsiteUrl and getProviderColors in providers.js