Migrating from REST to GraphQL
Differences in API logic
Migrating from REST to GraphQL represents a significant shift in API logic. The differences between REST as a style and GraphQL as a specification make it difficult—and often undesirable—to replace REST API calls with GraphQL API queries on a one-to-one basis. We've included specific examples of migration below.
To migrate your code from the REST API to the GraphQL API:
- Review the GraphQL spec
- Review Lumar's GraphQL schema
- Consider how any existing code you have currently interacts with the Lumar REST API
- Use Global Node IDs to reference objects in GraphQL API
Significant advantages of GraphQL include:
- Getting the data you need and nothing more
- Nested fields
- Strong typing