DTD using Postman

227 views
Skip to first unread message

Mark Jenkins

unread,
Dec 18, 2020, 6:58:29 AM12/18/20
to A gathering place for the Open Rail Data community
Hi All,

Anyone managed to get DTD working successfully using Postman on Mac?  I'm struggling with the authorisation POST syntax, seems like it should be really simple but not managing to hit on the right combination.  Want to use this on my Mac server in the interim while I work out a backend PushPort solution.

Main aim is to get a heartbeat going to prevent my account from expiring.  I have a daily CURL FTP pull running ok to get a snapshot from DARWIN which I thought would work but according to the DSG support team the FTP access doesn't keep the account alive.

Many thanks
Mark

Peter Hicks

unread,
Dec 18, 2020, 7:17:35 AM12/18/20
to A gathering place for the Open Rail Data community
Hi Mark

If you're concerned about losing access as a result of not using your account, I don't think you need worry.  The user limit that was hit on the NR Open Data platform doesn't seem to be an issue on the RDG portal.

What query are you sending through Postman at the moment?

Peter Hicks
Director
OpenTrainTimes Ltd.


--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openraildata-talk/057c6e21-05b8-4720-a6bc-4eac021cb167n%40googlegroups.com.


OpenTrainTimes Ltd. registered in England and Wales, company no. 09504022.
Registered office: Suite 1-3, Hop Exchange, 24 Southwark Street, London SE1 1TY

Mark Jenkins

unread,
Dec 18, 2020, 8:12:58 AM12/18/20
to A gathering place for the Open Rail Data community
Hi Peter, thanks for coming back....  Right now all I want to do is set up a simple heartbeat.  So first step grab a token via POST to https://opendata.nationalrail.co.uk/authenticate HTTP/1.1, then I'll pull some random DTD data just to get started - that's it.  Haven't got anywhere with it so far as its rejecting my credentials, so I figure I've got the format of the request wrong.  

For background, I have an account that unfortunately I lost the login details for and the token for that account is currently running my live App.  That's going in via OpenLDBWS and GetDepBoardWithDetails. What I want to do is move over to the new account - however my main focus so far has been researching PushPort, so I'm simply trying to keep this account fresh so I don't end up with the same problem as I did last time having used a token for an account I can't access.  Until I'm happy I can keep it fresh I won't move the token over for the live app.

Don't know if that all makes sense.

Cheers
Mark

Mark Jenkins

unread,
Dec 18, 2020, 9:23:19 AM12/18/20
to A gathering place for the Open Rail Data community
A little more detail, obviously I'm using my real credentials...

curl --location --request POST 'https://opendata.nationalrail.co.uk/authenticate HTTP/1.1' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=XXXXX' \
--data-urlencode 'password=YYYYY'

I've also tried the following format but with no luck

curl --location --request POST 'https://opendata.nationalrail.co.uk/authenticate HTTP/1.1' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-raw 'username=XXXXXX&password=YYYYYY'

I'm following the instructions here:

Cheers
Mark

Peter Hicks

unread,
Dec 18, 2020, 9:23:34 AM12/18/20
to A gathering place for the Open Rail Data community
Hi Mark

I've just put together a minimal Postman collection at https://github.com/openraildata/nrdp-postman-collection with the 'authenticate' call.  Give that a go.

If I remember correctly, there is no account as such for issuing OpenLDB(SV)WS tokens, and if you forget your token entirely, you have to create a new one.  It's not linked to your opendata.nationalrail.co.uk account - but there is a pass-through link on there which will take you to the site on which you sign up.

Let me know how you get on!

Best wishes,

Peter Hicks
Director
OpenTrainTimes Ltd.

Peter Hicks

unread,
Dec 18, 2020, 9:30:11 AM12/18/20
to A gathering place for the Open Rail Data community
Hi Mark

Yeah, those don't appear to work - I get a 400 back.  Try this (and I'll update the Wiki after contacting support):

curl --location --request POST 'https://opendata.nationalrail.co.uk/authenticate' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "username",
"password": "password"
}'

Peter Hicks
Director
OpenTrainTimes Ltd.

Mark Jenkins

unread,
Dec 18, 2020, 9:32:25 AM12/18/20
to A gathering place for the Open Rail Data community
Smashing, thanks Peter - it worked first time :)  I wouldn't have thought to set it up as Raw/JSON...  Thanks for the tip on the tokens as well.

Much appreciated!
Merry Xmas

Mark

Peter Hicks

unread,
Dec 18, 2020, 11:12:18 AM12/18/20
to A gathering place for the Open Rail Data community
Hi Mark

OK, after a quick chat with the support team at CAIC, I've added a cURL example to the wiki:
curl --location \
     --request POST \
     'https://opendata.nationalrail.co.uk/authenticate
' \
     --header 'Content-Type: application/x-www-form-urlencoded' \
     --data-urlencode 'username=us...@gmail.com' \
     --data-urlencode 'password=P@55w0rd1'

Peter Hicks
Director
OpenTrainTimes Ltd.

Mark Jenkins

unread,
Dec 18, 2020, 11:37:49 AM12/18/20
to A gathering place for the Open Rail Data community
Cool.  I did note that the Knowledgebase examples https://wiki.openraildata.com/KnowledgeBase show the JSON Body whereas the  DTD one didn't, so I guess I just chose the wrong API to start my adventure!  I've managed to pull Ticket Restrictions and Stations now without any issue so all good.

Thanks again for the assist :)

Reply all
Reply to author
Forward
0 new messages