Photo by Josh Riemer on Unsplash

Problem with REST API

Under-fetching: Single endpoint may not satisfy what the client needs, which you will need to call multiple endpoints to render the page (n + 1 problem)

Over-fetching: It is hard to flexibly choose what properties (data) you need from resources, the endpoint can give you more data than what you want.

Even you want to optimize the performance and get rid of the under/over fetching problem by creating a dedicating endpoint, it can lead to endpoint explosions at the end (too many endpoints) and hard to be maintained.