Cannot find Last-Modified header


#1

Hi,

According to https://opendata.transport.nsw.gov.au/node/326/exploreapi#!/sydneytrains/SydneyTrains
there should be a Last-Modified header.

The HEAD operation can be used to tell you if the content has changed (as GET may not return an HTTP 304 when no content has changed.)

For example, you may compare the Last-Modified header retrieved during a HEAD operation with the Last-Modified header retrieved during a previous GET operation. If the headers are the same, the content has not changed since the previous GET operation. If the headers are different, the content has changed since the previous GET operation.

I haven’t gotten that header on any request I make. Am I doing something wrong or is the header missing?

See below for sample request.

GET Request:

GET https://api.transport.nsw.gov.au/v1/gtfs/alerts/sydneytrains HTTP/1.1
Authorization: apikey [REDACTED]
Host: api.transport.nsw.gov.au

Response:

HTTP/1.1 200 OK
Date: Fri, 27 Apr 2018 12:46:46 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: [REDACTED] Expires=Fri, 04 May 2018 12:46:46 GMT; Path=/
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 10:00:00 AEST
Strict-Transport-Security: max-age=63072000
X-Frame-Options: DENY
X-Content-Type-Options: nosniff

[DATA]

HEAD Request:

HEAD https://api.transport.nsw.gov.au/v1/gtfs/alerts/sydneytrains HTTP/1.1
Authorization: apikey [REDACTED]
Host: api.transport.nsw.gov.au

Response:

HTTP/1.1 200 OK
Date: Fri, 27 Apr 2018 12:47:49 GMT
Content-Length: 0
Connection: keep-alive
Set-Cookie: [REDACTED] Expires=Fri, 04 May 2018 12:47:49 GMT; Path=/
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 10:00:00 AEST
Strict-Transport-Security: max-age=63072000
X-Frame-Options: DENY
X-Content-Type-Options: nosniff

Best Regards,
Johan


#2

Hi @jokar, the feed you’re looking at (alerts) is in real-time meaning it will just be up to date whenever you call it. It has a timestamp in the header section of the response body as below.
image

A last modified date mostly applies to datasets that are updated periodically, for example once per day, such as the static timetables or the full GTFS bundle.

Apologies if the notes from the API explorer are slightly misleading.

Thanks,
Alex


#3

Hi thanks for quick reply.
It kinda makes sense but it would have been useful for my intented usecase.