News for hackers. Stuff that matters.
Re:Why my favourite API is a zipfile on the European Central... by ipaddr on Friday September 15, 2023 @02:07PM (#37526968)
If data changes only once a year or rarely that would imply usage of the api is a rare event for a user of the data so speed isn't a huge concern. Caching would introduce more complexities and the risk of needing to manually revalidate the cache. The solution architect was probably right.
Re:Why my favourite API is a zipfile on the European Central... by xg15 on Friday September 15, 2023 @02:17PM (#37527112)
Why do rare writes imply rare usage? It's possible the file is read often and by different systems even if changes are infrequent.

If the API was used rarely, that would be even more of an argument for a simple implementation and not a complex system involving webhooks.

Re:Why my favourite API is a zipfile on the European Central... by paulddraper on Friday September 15, 2023 @02:34PM (#37527359)
> Caching would introduce more complexities

Apache/nginx do it just fine...

Re:Why my favourite API is a zipfile on the European Central... by justsomehnguy on Friday September 15, 2023 @02:30PM (#37527300)

  cat /api/version.txt
  2023.01.01

  ls /api
  version.txt data.zip
Re:Why my favourite API is a zipfile on the European Central... by accrual on Friday September 15, 2023 @02:34PM (#37527361)
Or maybe encode the version into the filename? It would overwrite if nothing changed, and the previous versions would remain available.

    2023.01.01-data.zip
Re:Why my favourite API is a zipfile on the European Central... by justsomehnguy on Friday September 15, 2023 @03:39PM (#37528174)
That requires preprocessing on the client and there are some ppl who has.. weird assumptions about how the dates should be written.

The version file can be quired at least the two ways:

the ETag/If-Modified-Since way (metadata only)

content itself

The best part with the last one - you don't need semver shenanigans. Just compare it with the latest dloaded copy, if version != dloaded => do_the_thing

Re:Why my favourite API is a zipfile on the European Central... by pests on Friday September 15, 2023 @04:50PM (#37528968)
Can't cache so you need to read it whenever you use the data, not just when it changes.