If you publish a RESTful API and there are situations when you need less (or more!) detail in the API responses from your API – then this post is for you. When I run into this with the teams I advise, the initial problem statement usually arrives more like “We need to move to GraphQL”, but this is a solution, not a problem to solve. The problem usually turns out to be either or both of:
- the API responses are simply too large for some of the clients or uses cases, users need to select just the fields they want
- the API doesn’t have enough information in the response payload for this client or use case, users need to choose to include nested data
GraphQL is one way to achieve these things, but this post is about the RESTful way to provide the right level of detail in an API response. Continue reading