GraphQL and gRPC
Other API styles.
REST isn't the only style. GraphQL lets the client ask for exactly the fields it needs. And g RPC is a fast binary style, popular between services inside a company.

- REST is not the only way
- GraphQL: ask for fields
- gRPC: fast, binary
GraphQL
With REST, a phone app might call three endpoints to build one screen, and get fields it doesn't need. With GraphQL, it sends one query, listing exactly the fields it wants, across several resources. The trade off is a more complex server, and harder caching.
REST
- Several calls per screenFixed responsesSimple to cache
GraphQL
- One query per screenExactly the fields askedHarder to cache
Choosing a style
So which should you use? REST is the safe default for public APIs. GraphQL shines when many different clients need different shapes of data. g RPC, with its compact binary messages, is great for fast calls between your own services. And many companies use all three.
| Style | Best for |
|---|---|
| REST + JSON | public APIs, simple |
| GraphQL | many clients, flexible data |
| gRPC | fast service-to-service |
Summary
REST is the default, GraphQL lets clients choose fields, and g RPC is fast between services. Next, how servers push updates to clients in real time.
Key takeaways- REST: default
- GraphQL: flexible
- gRPC: internal speed