Granularity is an essential principle of REST API design. As we understand business functions divided into many small actions are fine-grained, then business functions divided into large operations are coarse-grained. However, discussions about what level of granularity that needs to be in APIs may vary; we will get distinct suggestions and even end up in debates. Regardless, it is best to decide based on business functions and its use cases, as granularity decisions would undoubtedly vary on a case by case basis.

In some cases, calls across the network may be expensive and so, to minimize them a coarse-grained API may be the best fit, as each request from the client forces lot of work at the server side and, in fine-grained APIs, ...

Get Hands-On RESTful API Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.