From Open Rail Data Wiki
Revision as of 10:23, 21 February 2019 by JayPatel (talk | contribs)
Jump to navigation Jump to search


Knowledgebase is RDG’s Content Management System providing customer friendly information on the railways and associated products. It contains a wealth of static and real-time information about traveling by train on the GB rail network, such as information about station facilities, service disruption, and engineering work.

Knowledgebase data is available on National Rail Data Portal through 2 subscription types:

Knowledgebase (KB), Real Time incidents – for new, modified and deleted Incidents

Knowledgebase (KB), API – for requesting the latest information on the following static data

  • Companies (TOCs)
  • Incidents (Service Disruptions and Engineering Works)
  • National Service Indicator (NSI)
  • Promotions (Public)
  • Stations
  • Ticket Restrictions
  • Ticket Types

Accessing the Knowledgebase Feeds

To access the RDG Knowledgebase feeds, you must have an account on the National Rail Data Portal (NRDP) at By creating an account, you can register for a subscription to the Knowledgebase API and the Knowledgebase Real Time Feeds.

To receive Knowledgebase Real Time Incidents, select Knowledgebase (KB) Real Time Incidents under the Knowlegebase (KB) subscriptions. The connection information required to start receiving Real Time Incidents is located on the My Feeds page.

To receive Knowldegebase static data, select Knowledgebase (KB) API under the Knowledgebase (KB) subscriptions. The My Feeds page will then display details about accessing the latest versions of Ticket Restrictions, Companies, Incidents, National Service Indicator, Promotions (Public), Stations and Ticket Types files from Knowledgebase.

Important - Please note NRDP accounts expire after an extended period of inactivity. The unused account expiry period is currently set to 30 days. If you create an account and do not consume any of the feeds during this time your account will be deleted. If your account has been deleted, you will receive a notification email, and you will be able to re-register for a new account.

RDG Knowledgebase APIs

Knowledgebase API

After selecting the Knowledgebase (KB) API checkbox subscription type on NRDP, you can receive the Knowledgebase xml files in 2 steps via a rest client.

Step 1: Perform HTTP POST call to NRDP via to generate a token.

Step 2: Perform HTTP GET call to individual NRDP Knowledgebase Feeds using the token produced in step 1

Step 1: Generate Authentication Token

In this step, using a REST client you perform an HTTP POST call to This step requires using your email address and password registered on NRDP and will produce a token key. The following example shows the HTTP POST request and response with NRDP:

Request (Form-Encoded)


   Content-Type: application/x-www-form-urlencoded

Request (JSON Body)


     "username": "",
     "password": "password"

Response (Ok)

    "username": "",
    "roles": {
      "ROLE_STANDARD": true,
      "ROLE_KB_API": true
    "token": ""

The generated token is valid for 1 hour.

Response (Error)

If the credentials in the request payload are invalid, you will receive a 401 unauthorized response and JSON error body. The following http response example is generated after sending invalid credentials with the request.

     "error": "Invalid username/password"

Step 2: Perform a HTTP GET call for each Knowledgebase file

With an authentication token, performing a GET request will return the XML Knowledgebase data in the response.

Following the previous example, and wishing to consume the Ticket Restrictions feed:




Using the returned authentication token as an X-Auth-Token header.

Response (Ok)

   <?xml version="1.0" encoding="utf-8"?>

Response (Unauthenticated)

       "timestamp": "2019-02-13T11:50:16.048+0000",
       "status": 401,
       "error": "Unauthorized",
       "message": "Unauthorized",
       "path": "/api/staticfeeds/4.0/ticket-restrictions"

Response (Not Subscribed to Knowledgebase API)

       "timestamp": "2019-02-13T11:51:29.992+0000",
       "status": 403,
       "error": "Forbidden",
       "message": "Forbidden",
       "path": "/api/staticfeeds/4.0/ticket-restrictions"

Real Time Incident Feed

After selecting the Knowledgebase Real Time incidents checkbox subscription on edit account page, connection details will appear on the My Feeds page. You can receive the Knowledgebase real time incidents via a STOMP or Apache MQ OpenWire client as follows:

Using your preferred client, connect to the Message topic host using the credentials and topic name shown on My Feeds/ Knowledgebase Real Time Incidents Information.

Please note: topic advisory messages are disabled on the KB Real Time Incidents messaging host, so you must also connect with this facility disabled. E.g. set the connection property watchTopicAdvisories=false.

Upon successfully connecting to ActiveMQ, you will start receiving each real time incident message, with its respective incident number and other message information.


Real time incidents messages contain the following headers:


Each message will contain a INCIDENT_MESSAGE_STATUS header, with the possible values:

  • NEW: This status represents new incident message information
  • MODIFIED: This status represents modifications to existing incidents message information
  • REMOVED: This status represents deleted message information


Each message contains a KNOWLEDGEBASE_DATA_TYPE detailing that the message is an INCIDENT_MESSAGE.


The ID of the Knowledgebase Incident message.

Example Real Time Incidents Bodies

The following are examples of Real Time Incidents which include new, modified and deleted incident messages. Please note that these bodies are unzipped, real messages contain gzipped data.

New Incident message

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
< xmlns:ns2="" xmlns:ns3="">
<ns3:Summary>Possible industrial action to affect Southern services on Saturday 8 April</ns3:Summary>
<p>The RMT Union have announced they are planning to take industrial action on Saturday 8 April.</p>
<p>It is not yet known how Southern services will be affected, if this industrial action goes ahead.</p>
<p><strong>Twitter:</strong><br />
If you would like to follow this incident on Twitter, please use <a href="">#SouthernStrike</a></p>
<ns3:RoutesAffected><p>Various Southern routes</p></ns3:RoutesAffected></ns3:Affects>

Modified Incident Message

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
< xmlns:ns2="" xmlns:ns3="">
<ns3:Planned>false</ns3:Planned><ns3:Summary>Delays in theCrystal Palace area expected until 20:15</ns3:Summary>
<p>Due <span>to trespassers on the railway at Crystal Palace trains have to run at reduced speed on all lines.
<br /><br /><strong>Impact:</strong>
<br />Train services running through this station may be cancelled or delayed by up to20 minutes. Disruption is expected until 20:15 24/04.<br />
<br /><strong>Customer Advice:</strong>
<br />Owing to a passenger forcing the doors open and exiting the train onto the trackin the Crystal Palace area trains are obliged to run at a reduced speed.<br/></span></p>
<p><strong>Twitter:</strong><br />If you would like to follow this incident on Twitter, please use
 <a href="">#</a><span><a href="">CrystalPalace</a> </span></p>
 <p><strong>Check before you travel:</strong><br />Please use the National Rail Enquiries real-time
 <a href="">Journey Planner</a> to check your journey before you travel.</p>
 <p><strong>Compensation:</strong><br />You may be entitled to <a href="">
 compensation</a> if you experience a delay in completing your journey today.
 Please keep your train ticket and make a note of your journey, as both will be required to support any claim.</p>
 <p><strong>Feedback:</strong><br />We want to make information better - tell us how! Fill out this online
 <a href="">Disruption Survey.</a></p></ns3:Description>
<ns3:Label>Additional Maps</ns3:Label></ns3:InfoLink></ns3:InfoLinks>
<ns3:RoutesAffected><p>Routes through Crystal Palace</p></ns3:RoutesAffected></ns3:Affects>

Removed Incident Message

Removed messages contain empty bodies.


KnowledgeBase XML schemas:

Supporting/referenced schemas:

KnowledgeBase specification: