REST vs GraphQL
A practical look at when to use GraphQL vs REST APIs for headless CMS integrations - and how Scalar supports both.

REST vs GraphQL
A practical look at when to use GraphQL vs REST APIs for headless CMS integrations - and how Scalar supports both.
The API Dilemma
When building applications that consume content from a headless CMS, one of the first architectural decisions is choosing between REST and GraphQL APIs. Both approaches have passionate advocates, and both have distinct strengths and limitations.
Rather than declaring a winner, this guide helps you make an informed choice based on your specific project needs. At Scalar, we support both API paradigms because we understand different projects have different requirements.
Understanding the Basics
REST: The Established Standard
REST (Representational State Transfer) has been the dominant API pattern for over a decade. It organizes resources into endpoints that follow standard HTTP methods (GET, POST, PUT, DELETE):
GET /api/blog-posts # Get all blog posts
GET /api/blog-posts/123 # Get a specific blog post
POST /api/blog-posts # Create a new blog post
PUT /api/blog-posts/123 # Update a blog post
DELETE /api/blog-posts/123 # Delete a blog post
GraphQL: The Flexible Newcomer
GraphQL, developed by Facebook and released in 2015, uses a single endpoint where clients specify exactly what data they need:
query {
blogPost(id: "123") {
title
author {
name
profileImage
}
comments {
text
createdAt
}
}
}
Key Differences
Aspect | REST | GraphQL |
---|---|---|
Endpoints | Multiple endpoints for different resources | Single endpoint for all operations |
Data fetching | Often requires multiple requests to get related data | Can fetch complex related data in a single request |
Overfetching | Common - endpoints return fixed data structures | Rare - clients specify exactly what they need |
Underfetching | Common - may need multiple requests | Rare - can request all needed data at once |
Caching | Simple, built into HTTP | Requires custom implementation |
File uploads | Native support | Requires extensions |
Error handling | HTTP status codes | Always returns 200 with errors in response |
Tooling | Vast ecosystem | Growing ecosystem |
When to Choose REST
REST may be your better option when:
1. You need simple, resource-oriented operations
For basic CRUD operations on well-defined resources, REST provides a straightforward implementation that most developers already understand.
2. You want to leverage HTTP caching
REST's alignment with HTTP methods makes it easy to use standard caching mechanisms, both on the client side and with CDNs.
3. Your API consumers have bandwidth limitations
REST can be more efficient for small, focused requests where you don't need related data.
4. You need straightforward file handling
REST handles file uploads natively through multipart requests, while GraphQL requires additional implementation.
When to Choose GraphQL
GraphQL shines when:
1. Your frontend needs flexible data requirements
Different views may need different fields from the same resources. GraphQL lets clients specify exactly what they need.
2. You want to reduce network requests
Instead of making multiple API calls to assemble a complex view, GraphQL can fetch all required data in a single request.
3. Your data is highly relational
GraphQL makes it easy to traverse relationships between resources without additional endpoint calls.
4. You need strong typing and introspection
GraphQL's schema system provides built-in documentation and type checking.
How Scalar Supports Both Approaches
Scalar gives you the freedom to choose the right API for your needs:
REST API Features
- Resource-based endpoints for all content types
- Standard CRUD operations
- Filtering, sorting, and pagination
- Relationship expansion via query parameters
- Asset handling and file uploads
- Comprehensive documentation
GraphQL API Features
- Full schema generation from your content models
- Nested queries for related content
- Mutations for content creation and updates
- Filtering, sorting, and pagination arguments
- Built-in documentation via introspection
- Performance optimizations to prevent N+1 queries
Hybrid Approaches
Many Scalar users adopt a hybrid approach:
- Using GraphQL for complex, data-heavy frontend views
- Using REST for simple administrative actions or file uploads
- Leveraging REST for public-facing cached content
- Employing GraphQL for personalized or dynamic content
Conclusion
There's no one-size-fits-all answer to the REST vs GraphQL question. By supporting both API styles, Scalar gives you the flexibility to choose the right approach for each specific use case in your project.
Whether you prefer the simplicity and familiarity of REST or the flexibility and efficiency of GraphQL, Scalar provides optimized implementations of both paradigms.
Wrap-up
A CMS shouldn't slow you down. Scalar aims to expand into your workflow — whether you're coding content models, collaborating on product copy, or launching updates at 2am.
If that sounds like the kind of tooling you want to use — try Scalar or join us on Discord.