From Open Rail Data Wiki
Jump to navigation Jump to search


KnowledgeBase is RDG’s Content Management System providing customer friendly information on the railways and associated products. KnowledgeBase data is available on National Rail Data Portal through 2 subscription types

  • Real Time Data Feeds – for new, modified and deleted Incidents
  • On Demand Data Feeds – for requesting the latest information on the following
    • Ticket Restrictions
    • Companies
    • Incidents
    • National Service Indicator
    • Promotions (Public)
    • Stations
    • 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 After logging in, you will see 3 subscription types: Historical Service Performance (HSP), Real Time Data Feeds and On Demand Data Feeds. By selecting the checkbox for each of these subscription types, the respective sections become visible on the My Feeds page.

The previous Darwin Data Feed on the NRDP Account page has been replaced by the Real Time Data Feed which once selected include details about the Darwin push-port feeds and the KnowledgeBase – Real Time Incident feed in the My Feeds page.

To receive KnowledgeBase Real Time Incidents, select Real Time Data Feeds under Subscription Type in the Edit User Details page and then select the Update button to save this change. Go to the My Feeds page and select the KnowledgeBase data type – Real Time Incidents option. You will need the Real Time Information /STOMP details to start receiving real time incident messages via a STOMP client.

The On Demand Data Feeds section on the My Feeds page contains details about accessing the latest versions of Ticket Restrictions, Companies, Incidents, National Service Indicator, Promotions (Public), Stations and Ticket Types files from KnowledgeBase. To receive these KnowledgeBase files, select the On Demand Data Feeds checkbox under the Subscription type in the Edit User Details page and then select the update button to save this change.

RDG KnowledgeBase APIs

On Demand Data Feeds

After selecting the On Demand checkbox subscription type on NRDP, you can receive the KnowlegeBase xml files in 2 steps via a rest client.

Step 1: Generate 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:

Example HTTP POST Request to NRDP:
   Content-Type: application/x-www-form-urlencoded
   Accept: application/json, text/plain, */*
   Raw payload:
   //Add your registered NRDP email address and NRDP password in the “Raw payload” section above 
Corresponding example HTTP Response from NRDP:
 "username": " ",
 "roles": {
 "Role(id=6ab28d46-0e4a-11e7-9339-060a84373309, name='ROLE_KB_USER')": true,
 "Role(id=47d36dc4-16b9-11e6-9746-060a84373309, name='ROLE_HSP_USER')": true,
 "Role(id=4e660138-bb39-11e4-9da1-060a84373309, name='ROLE_D3_USER')": true
 "token": ""

Each token is valid for 1 hour and you will receive a 401 unauthorized response when the token has expired. The following http response example is generated after sending an http request to a NRDP knowledgebase feed with an expired token.

Example HTTP 401 Response Header: Token Expired:
 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
 Content-Language: en
 Content-Length: 1081
 Content-Type: text/html;charset=utf-8
 Date: Wed, 05 Apr 2017 09:52:11 GMT
 Expires: 0
 Pragma: no-cache
 Server: Apache-Coyote/1.1
 X-Content-Type-Options: nosniff
 X-Frame-Options: DENY
 X-Xss-Protection: 1; mode=block 
Corresponding example HTML Response file: Token Expired:
 <title>Apache Tomcat/7.0.56 - Error report</title>
 <!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-
 size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-
 color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A 
 {color : black;} {color : black;}HR {color : #525D76;}-->
 </style> </head>
 <h1>HTTP Status 401 - Unauthorized: Authentication token was either missing or invalid.</h1>
 <HR size="1" noshade="noshade">
 <b>type</b> Status report</p>
 <b>message</b> <u>Unauthorized: Authentication token was either missing or invalid.</u>
 <b>description</b> <u>This request requires HTTP authentication.</u>
 <HR size="1" noshade="noshade">
 <h3>Apache Tomcat/7.0.56</h3>

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

In this step using a REST client, you would perform a HTTP GET call to each Knowledgebase file using the token key produced in step 1. This will produce the xml file for the corresponding KnowledgeBase feeds. The following are the required links to make the respective HTTP GET call:

The header of the HTTP response will also include the date when the xml file was last modified using this format: Last-Modified: DAY, DD MMM YYYY HH:MM:SS GMT The following is an example of request/response with Ticket Restrictions Knowledgebase Feed via NRDP:

Example HTTP GET Request to NRDP knowledgebase feed:
Content-Type: application/json
Accept: */*
X-Auth-Token: NRDP_email_address:1491312310772:56c56baa3e56d35ff0ede4a6aad1bcfb
//Enter your NRDP email address and the Token Key used in step 1 above
Corresponding example HTTP 200 Response Header:
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: 1194601
Content-Type: text/plain;charset=ISO-8859-1
Date: Wed, 05 Apr 2017 08:29:16 GMT
Expires: 0
Last-Modified: Wed, 05 Apr 2017 08:16:39 GMT
Pragma: no-cache
Server: Apache-Coyote/1.1
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Xss-Protection: 1; mode=block
Corresponding XML Response file
 <?xml version="1.0" encoding="utf-8"?>
<TicketRestrictions xmlns:xsd="" xmlns:xsi="" xmlns:com="" xsi:schemaLocation="" xmlns="">
    <Name><![CDATA[S2]]></Name>    <LinkToDetailPage><![CDATA[1]]></LinkToDetailPage>

TEST SM 19/01

]]></ApplicableDays> <OutwardDirection>Outward Travel</OutwardDirection> <ReturnDirection>Return Travel</ReturnDirection> <RestrictionsType>2</RestrictionsType> <Restrictions> <Restriction> <DetailsOutward><![CDATA[

SM 2

]]></DetailsOutward> <DetailsReturn><![CDATA[


]]></DetailsReturn> </Restriction> </Restrictions> </TicketRestriction> </pre

Real Time Incident Feed