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.
Apache/nginx do it just fine...
cat /api/version.txt
2023.01.01
ls /api
version.txt data.zip 2023.01.01-data.zipThe 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
If you want to get really fancy, offer an additional webhook which triggers if the file changes - so clients know when to redownload it and don't have to poll once a day.
...or make a script that sends a predefined e-mail to a mailing list when there is a change.
See above. Also you can just publish the version in DNS with a long enough TTL
I completely agree and csvbase already implements this (so does curl btw), try:
curl --etag-compare stock-exchanges-etag.txt --etag-save stock-exchanges-etag.txt https://csvbase.com/meripaterson/stock-exchanges.parquet -OMy concern was "what if file is updated while it's mid-download" but Linux would probably keep the old version of the file until the download finishes (== until file is still open by webserver process). Probably. It's better to test
The whole data set could have been zipped into a <1MB file but instead a “solution architect” go their hands on the requirements. We ended up with a slow API because they wouldn’t let us cache results in case the data had changed just as it was requested. And an overly complex webhook system for notifying subscribers of changes to the data.
A zip file probably was too simple, but not far off what was actually required.