Hacker News new | past | comments | ask | show | jobs | submit login

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?

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.

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

It does, but I think what you're really after here is a mechanism for cache invalidation.

Check out PostgreSQL's LISTEN and NOTIFY:



A related HN discussion a few years ago: https://news.ycombinator.com/item?id=6689213

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.

Thanks, unfortunately the new data updates can vary.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact