What is the right way to build a cool new API?
For a long time, REST was thought to be the only appropriate tool for building modern APIs. But in recent years, another tool was added to the toolbox, when Facebook published GraphQL, the philosophy, and framework powering its popular API. More and more tech companies tried GraphQL and adopted it as one of their philosophies for API design. Some built GraphQL API next to their existing REST API, some replaced their REST API with GraphQL, and even others ignored the GraphQL trend to focus only on their REST API.
But, not only the tech companies are divided. Following the discussions around REST and GraphQL, there seem to be two camps of gurus leading very emotional discussions: “always use the hammer,” one camp proclaims. “NO, always use the screwdriver,” the other camp insists. And for the rest of us? Unfortunately, this situation is confusing, leading to paralysis and indecision about API design.
The intention of this book is to clear up the confusion and enable us to make our own decision. For our own API. By having the necessary criteria and background info, we can choose if the hammer or the screwdriver is better for our API project. This book will not say: use the hammer or use the screwdriver. Instead, this book will enable us to make a smart, reasonable and case-specific decision, a decision tailored to the specific API we are designing.
Who should read this book?
You want to realize a new API, so you ask yourself, whether you should use REST or GraphQL. When building a new API, it is a case-by-case decision to go with REST or GraphQL. For each approach, there are use cases where they can shine.
What is in the book?
In this book, we introduce GraphQL and REST as two competing philosophies for building APIs. We compare the two philosophies side-by-side, explore their strength and weaknesses, the commonalities and major differences.