Some feedback after playing with API

I’ve implemented downloading and processing from an endpoint - https://api.transport.nsw.gov.au/v1/publictransport/timetables/complete/gtfs

I found the endpoint does not respect ‘If-Modified-Since’ header - If-Modified-Since - HTTP | MDN

I think it can save efforts, time and bandwidth if all real-time endpoints and the above gtfs endpoint respect the header.

For example, without using ‘if-modified-since’, my current design is:

  1. Hit the endpoint with the HEAD method
  2. Get ‘last-modified’ header value, then convert it to a long value
  3. Check local folder has a file named "gtfs-the-long-value.zip
  4. If there is a file with the name, then exit - nothing to do
  5. Otherwise, download, extract some files, trim columns, sort rows, compare with previous files, generate DB operations, run DB operations.

With ‘if-modified-since’, 2-4 can be simplified like

2. if HTTP code is 304, then exit - nothing to do

1 Like

Hi @oz.jc, thanks for bringing this to our attention, we’ll see if we can implement the if-modified-since header value so it’s easier for you guys to work with our APIs.

For the time being the method you described is the right way to do it.

Thanks,
Alex

2 Likes