NodeJS API Wrapper

After noticing a lack of up to date API wrappers for the Node JS, I decided to write my own in TypeScript and open source it. At present it doesn’t include all endpoints however, Pull Requests are welcome.

npm install tfl-api-wrapper
yarn add tfl-api-wrapper

Github
Docs

2 Likes

Nice work.

Just out of interest, the examples show

const config = {
   app_key: 'API KEY HERE',
};

But TfL uses a double-part API key. app_id and app_key

1 Like

Originally app_id was implemented, however I recall seeing somewhere on this forum that the new portal doesn’t provide them. So they were removed from the wrapper. If it’s something that people would want re-adding then that’s totally possible

I guess the documentation at https://api.tfl.gov.uk/ still mentions both

but the new site https://api-portal.tfl.gov.uk/ doesn’t


Only an app_key in my profile section too, I’ll have a look for the post where it was mentioned.

This is incorrect, the app_id parameter was not migrated to the new developer portal and you only need to include the app_key. See “What will happen with my API credentials?” in the post linked below.

Thanks, I knew there was a thread about this somewhere. Much appreciated!

1 Like

Thanks @zackaryh8 for your link.

Perhaps @jamesevans would be kind enough to have someone hack into their https://api.tfl.gov.uk/ server page and remove the reference to the now redundant value? It the page Google likes the best so a random potential API developer will see it!

I’ve started work on the wrapper for TrackerNet, I’ve decided to keep it in the same npm package, but make it it’s own export. Seen below is some example output of the wrapper, no more dealing with XML! Feel free to review the pull request.

1 Like

Version 1.3.0 is now available here

  • Added TrackerNet methods
  • Restructured interfaces
1 Like

I’ve started to convert this wrapper to Python and forked another repository for Golang to finish the work that was started.

1 Like

How did this go? I’m happy to try and test it

Which one were you looking to test? If it’s Python then some of the API has been implemented, but not all of it. As for the Go wrapper, I need to get my head around structs before I keep implementing stuff.

A new release is coming soon, I’ve completely reworked the TrackerNet part of the this package. I’ve written a C++ script which changes the XML tags to something human-readable. Then using a dependency I have converted it to JSON. This has allowed me to get rid off the god awful triple return maps.

C++ XML Retag Utility

Version 1.6.0 Released!

Changes:

  • Rename getValidModes to getModes
  • Rename getallByNaptan to getAllByNaptan
  • Add TrackerNet station codes enum
  • Add return types to all methods, fianlly!