Re:Ask HN: How do you version your data?
by hbcondo714 on Monday February 20, 2017 @02:18AM
(#13685125)
On a somewhat related note, I have an API that returns time series data. The API itself is versioned but not the data when it is added to since the endpoint is the same. How would I go about notifying consumers of the API that the data has been updated and they should call the API to get the latest data? Would versioning the data help with this?
[ Parent
| on HN ]
Re:Ask HN: How do you version your data?
by webmaven on Monday February 20, 2017 @02:52AM
(#13685310)
Most data versioning approaches would help bulk consumers of the data, rather than through the API.
You could add a separate "changes" feed to help API consumers, or inline version info to the main API results.
Re:Ask HN: How do you version your data?
by hbcondo714 on Monday February 20, 2017 @03:30AM
(#13685489)
Thanks, was thinking about doing a new endpoint for changes too but wanted to see if this topic of data versioning pertains to this or not
Re:Ask HN: How do you version your data?
by webmaven on Monday February 20, 2017 @12:53PM
(#13689312)
It does, but I think what you're really after here is a mechanism for cache invalidation.
Check out PostgreSQL's LISTEN and NOTIFY:
https://www.postgresql.org/docs/9.6/static/sql-listen.html
https://www.postgresql.org/docs/9.6/static/sql-notify.html
A related HN discussion a few years ago: https://news.ycombinator.com/item?id=6689213
Re:Ask HN: How do you version your data?
by nepsilon on Monday February 20, 2017 @03:17AM
(#13685428)
If you can predict when you're going to get new content, just use an HTTP header to tell until when the content can be seen as fresh. Then the client will know when to call the API again.
If not, ask the client to provide an HTTP callback endpoint, and ping it to notify of new fresh data on your side. Using WebSocket is also an option.
Re:Ask HN: How do you version your data?
by hbcondo714 on Monday February 20, 2017 @03:32AM
(#13685497)
Thanks, unfortunately the new data updates can vary.